Skip to content

Commit

Permalink
fix checkWeapon function
Browse files Browse the repository at this point in the history
Fixes issues where giving or dropping a currently equipped weapon does not remove it from your ped, so you can continue to shoot a weapon that you do not posses. 

Issues:
#556
  • Loading branch information
Sanriku-Gaming authored Jul 28, 2024
1 parent 118126b commit f70da43
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ end)
-- Functions

local function checkWeapon(source, item)
local currentWeapon = type(item) == 'table' and item.name or item
local ped = GetPlayerPed(source)
local weapon = GetSelectedPedWeapon(ped)
local weaponInfo = QBCore.Shared.Weapons[weapon]
if weaponInfo and weaponInfo.name == item.name then
if weaponInfo and weaponInfo.name == currentWeapon then
RemoveWeaponFromPed(ped, weapon)
TriggerClientEvent('qb-weapons:client:UseWeapon', source, { name = currentWeapon }, false)
end
end

Expand Down

0 comments on commit f70da43

Please sign in to comment.