From 7f4f4d14e03fd76ea0642d0784561d98a72a0263 Mon Sep 17 00:00:00 2001 From: MiddleSkillz Date: Thu, 6 May 2021 02:18:29 -0600 Subject: [PATCH] refactor: Optimize weapon ammo tracking --- client/main.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/main.lua b/client/main.lua index f6dd1d79..94ad977d 100644 --- a/client/main.lua +++ b/client/main.lua @@ -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)