mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Further performance improvements
This commit is contained in:
+23
-23
@@ -73,10 +73,9 @@ Citizen.CreateThread(function()
|
||||
isInATMMarker = false
|
||||
|
||||
for k,v in pairs(Config.ATMLocations) do
|
||||
if(GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < Config.ZoneSize.x / 2) then
|
||||
isInATMMarker = true
|
||||
ESX.ShowHelpNotification(_U('press_e_atm'))
|
||||
canSleep = false
|
||||
if GetDistanceBetweenCoords(coords, v.x, v.y, v.z, true) < 1.0 then
|
||||
isInATMMarker, canSleep = true, true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
@@ -107,31 +106,32 @@ Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
|
||||
if menuIsShowed then
|
||||
DisableControlAction(0, 1, true) -- LookLeftRight
|
||||
DisableControlAction(0, 2, true) -- LookUpDown
|
||||
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
|
||||
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
|
||||
elseif IsControlJustReleased(0, Keys['E']) and isInATMMarker and IsPedOnFoot(PlayerPedId()) then
|
||||
menuIsShowed = true
|
||||
ESX.TriggerServerCallback('esx:getPlayerData', function(data)
|
||||
SendNUIMessage({
|
||||
showMenu = true,
|
||||
player = {
|
||||
money = data.money,
|
||||
accounts = data.accounts
|
||||
}
|
||||
})
|
||||
end)
|
||||
if isInATMMarker and not menuIsShowed then
|
||||
|
||||
SetNuiFocus(true, true)
|
||||
elseif (not isInATMMarker and not menuIsShowed) then
|
||||
ESX.ShowHelpNotification(_U('press_e_atm'))
|
||||
|
||||
if IsControlJustReleased(0, Keys['E']) and IsPedOnFoot(PlayerPedId()) then
|
||||
menuIsShowed = true
|
||||
ESX.TriggerServerCallback('esx:getPlayerData', function(data)
|
||||
SendNUIMessage({
|
||||
showMenu = true,
|
||||
player = {
|
||||
money = data.money,
|
||||
accounts = data.accounts
|
||||
}
|
||||
})
|
||||
end)
|
||||
|
||||
SetNuiFocus(true, true)
|
||||
end
|
||||
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- close the menu when script is restarting to avoid being stuck in NUI focus
|
||||
-- close the menu when script is stopping to avoid being stuck in NUI focus
|
||||
AddEventHandler('onResourceStop', function(resource)
|
||||
if resource == GetCurrentResourceName() then
|
||||
if menuIsShowed then
|
||||
|
||||
Reference in New Issue
Block a user