Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,26 +184,32 @@ CreateThread(function()
end)

CreateThread(function()
local _sleep = true
while true do
local ped = PlayerPedId()
if IsPedArmed(ped, 7) == 1 and (IsControlJustReleased(0, 24) or IsDisabledControlJustReleased(0, 24)) then
_sleep = false
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
else
_sleep = true
end
Wait(0)
Wait(_sleep and 750 or 0)
end
end)

CreateThread(function()
local _sleep = true
while true do
if LocalPlayer.state.isLoggedIn then
local ped = PlayerPedId()
if CurrentWeaponData and next(CurrentWeaponData) then
_sleep = false
if IsPedShooting(ped) or IsControlJustPressed(0, 24) then
local weapon = GetSelectedPedWeapon(ped)
if CanShoot then
Expand All @@ -222,9 +228,11 @@ CreateThread(function()
end
end
end
else
_sleep = true
end
end
Wait(0)
Wait(_sleep and 750 or 0)
end
end)

Expand Down
Loading