diff --git a/[esx]/esx_identity/client/main.lua b/[esx]/esx_identity/client/main.lua index c95ff09c..097815b8 100644 --- a/[esx]/esx_identity/client/main.lua +++ b/[esx]/esx_identity/client/main.lua @@ -57,9 +57,10 @@ if not Config.UseDeferrals then CreateThread(function() while true do - Wait(0) + local sleep = 1500 if guiEnabled then + sleep = 0 DisableControlAction(0, 1, true) -- LookLeftRight DisableControlAction(0, 2, true) -- LookUpDown DisableControlAction(0, 106, true) -- VehicleMouseControlOverride @@ -79,9 +80,8 @@ if not Config.UseDeferrals then DisableControlAction(0, 143, true) -- disable melee DisableControlAction(0, 75, true) -- disable exit vehicle DisableControlAction(27, 75, true) -- disable exit vehicle - else - Wait(500) end + Wait(sleep) end end) end diff --git a/[esx_addons]/esx_atm/client/main.lua b/[esx_addons]/esx_atm/client/main.lua index 55ea7d73..c63cb8e5 100644 --- a/[esx_addons]/esx_atm/client/main.lua +++ b/[esx_addons]/esx_atm/client/main.lua @@ -45,15 +45,14 @@ end) -- Activate menu when player is inside marker CreateThread(function() while true do - Wait(0) local coords = GetEntityCoords(PlayerPedId()) - local canSleep = true + local Sleep = 1500 isInATMMarker = false for k,v in pairs(Config.ATMLocations) do local Pos = vector3(v.x,v.y,v.z) - if #(coords - Pos) < 1.0 then - + if #(coords - Pos) < 2.0 then + Sleep = 0 isInATMMarker, canSleep = true, false break end @@ -74,20 +73,17 @@ CreateThread(function() hideAll = true }) end - - if canSleep then - Wait(500) - end + Wait(Sleep) end end) -- Menu interactions CreateThread(function() while true do - Wait(0) + local Sleep = 1500 if isInATMMarker and not menuIsShowed then - + Sleep = 0 ESX.ShowHelpNotification(_U('press_e_atm')) if IsControlJustReleased(0, 38) and IsPedOnFoot(PlayerPedId()) then @@ -104,10 +100,8 @@ CreateThread(function() SetNuiFocus(true, true) end - - else - Wait(700) end + Wait(Sleep) end end)