From b0151a0d015d28e89218f49dfc51ec014ddbed90 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:07:30 +1000 Subject: [PATCH] fix(client): disarm weapon on inventory wipe Resolves #1472. --- client.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client.lua b/client.lua index 356e5d9361..d9b07029e0 100644 --- a/client.lua +++ b/client.lua @@ -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]