refactor: Optimize weapon ammo tracking

This commit is contained in:
MiddleSkillz
2021-05-06 02:18:29 -06:00
parent ca9515d615
commit 7f4f4d14e0
+6 -4
View File
@@ -362,11 +362,10 @@ function StartServerSyncLoops()
while true do
Citizen.Wait(1000)
if isDead then
Citizen.Wait(500)
else
local playerPed = PlayerPedId()
local letSleep = true
local playerPed = PlayerPedId()
if IsPedArmed(playerPed, 4) then
if IsPedShooting(playerPed) then
local _,weaponHash = GetCurrentPedWeapon(playerPed, true)
local weapon = ESX.GetWeaponFromHash(weaponHash)
@@ -377,6 +376,9 @@ function StartServerSyncLoops()
end
end
end
if letSleep then
Citizen.Wait(500)
end
end
end)