diff --git a/client/main.lua b/client/main.lua index 813ee33..0831f63 100644 --- a/client/main.lua +++ b/client/main.lua @@ -183,19 +183,24 @@ CreateThread(function() SetWeaponsNoAutoswap(true) end) + CreateThread(function() while true do local ped = PlayerPedId() - if IsPedArmed(ped, 7) == 1 and (IsControlJustReleased(0, 24) or IsDisabledControlJustReleased(0, 24)) then - local weapon = GetSelectedPedWeapon(ped) - local ammo = GetAmmoInPedWeapon(ped, weapon) - TriggerServerEvent('qb-weapons:server:UpdateWeaponAmmo', CurrentWeaponData, tonumber(ammo)) - if MultiplierAmount > 0 then - TriggerServerEvent('qb-weapons:server:UpdateWeaponQuality', CurrentWeaponData, MultiplierAmount) - MultiplierAmount = 0 + if GetSelectedPedWeapon(ped) ~= `WEAPON_UNARMED` then + if IsPedArmed(ped, 7) == 1 and (IsControlJustReleased(0, 24) or IsDisabledControlJustReleased(0, 24)) then + local weapon = GetSelectedPedWeapon(ped) + local ammo = GetAmmoInPedWeapon(ped, weapon) + TriggerServerEvent('qb-weapons:server:UpdateWeaponAmmo', CurrentWeaponData, tonumber(ammo)) + if MultiplierAmount > 0 then + TriggerServerEvent('qb-weapons:server:UpdateWeaponQuality', CurrentWeaponData, MultiplierAmount) + MultiplierAmount = 0 + end end + Wait(0) + else + Wait(1000) end - Wait(0) end end) @@ -222,9 +227,12 @@ CreateThread(function() end end end + Wait(0) + else + Wait(1000) end end - Wait(0) + Wait(1) end end)