Skip to content

Commit

Permalink
fix(client): disarm weapon on inventory wipe
Browse files Browse the repository at this point in the history
Resolves #1472.
  • Loading branch information
thelindat committed Sep 12, 2023
1 parent c5742ac commit b0151a0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,13 @@ local function updateInventory(data, weight)
v.inventory = 'player'
local item = v.item

if currentWeapon?.slot == item?.slot and item.metadata then
currentWeapon.metadata = item.metadata
TriggerEvent('ox_inventory:currentWeapon', currentWeapon)
if currentWeapon?.slot == item?.slot then
if item.metadata then
currentWeapon.metadata = item.metadata
TriggerEvent('ox_inventory:currentWeapon', currentWeapon)
else
currentWeapon = Weapon.Disarm(currentWeapon, true)
end
end

local curItem = PlayerData.inventory[item.slot]
Expand Down

0 comments on commit b0151a0

Please sign in to comment.