From ecb975feed30659ea78409bf74d519dc5e782057 Mon Sep 17 00:00:00 2001 From: Csoki Date: Sun, 22 Jan 2023 18:52:35 +0100 Subject: [PATCH] refactor(esx_menu_dialog): remove useless thread if nui cursor is active, movement is disabled. --- [core]/esx_menu_dialog/client/main.lua | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/[core]/esx_menu_dialog/client/main.lua b/[core]/esx_menu_dialog/client/main.lua index f58986c9..2720c412 100644 --- a/[core]/esx_menu_dialog/client/main.lua +++ b/[core]/esx_menu_dialog/client/main.lua @@ -30,10 +30,9 @@ local function closeMenu(namespace, name) name = name, }) - if ESX.Table.SizeOf(OpenedMenus) == 0 then + if not next(OpenedMenus) then SetNuiFocus(false) end - end ESX.UI.Menu.RegisterType(MenuType, openMenu, closeMenu) @@ -78,24 +77,4 @@ AddEventHandler('esx_menu_dialog:message:menu_change', function(data) if menu.change ~= nil then menu.change(data, menu) end -end) - -CreateThread(function() - while true do - Wait(0) - - if ESX.Table.SizeOf(OpenedMenus) > 0 then - DisableControlAction(0, 1, true) -- LookLeftRight - DisableControlAction(0, 2, true) -- LookUpDown - DisableControlAction(0, 142, true) -- MeleeAttackAlternate - DisableControlAction(0, 106, true) -- VehicleMouseControlOverride - DisableControlAction(0, 12, true) -- WeaponWheelUpDown - DisableControlAction(0, 14, true) -- WeaponWheelNext - DisableControlAction(0, 15, true) -- WeaponWheelPrev - DisableControlAction(0, 16, true) -- SelectNextWeapon - DisableControlAction(0, 17, true) -- SelectPrevWeapon - else - Wait(500) - end - end end) \ No newline at end of file