Further performance improvements

This commit is contained in:
ElPumpo
2018-11-11 12:06:03 +01:00
parent 0ca59d6766
commit af2f506110
2 changed files with 25 additions and 24 deletions
+23 -23
View File
@@ -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
+2 -1
View File
@@ -1,7 +1,8 @@
Config = {}
Config.ZoneSize = {x = 3.0, y = 3.0, z = 0.3}
Config.ZDiff = 2.0
Config.BlipSprite = 431
Config.Locale = 'fr'
Config.EnableBlips = false -- for some reason ATM blips are extremly buggy and will bug out the map