Skip to content

Commit

Permalink
fix(client): ped weapons removed before disarm animation
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Aug 5, 2023
1 parent 632a77e commit 1c6cce6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -467,22 +467,22 @@ local function useSlot(slot)

if IsCinematicCamRendering() then SetCinematicModeActive(false) end

GiveWeaponToPed(playerPed, data.hash, 0, false, true)
SetCurrentPedWeapon(playerPed, data.hash, true)

if data.hash ~= GetSelectedPedWeapon(playerPed) then
return lib.notify({ type = 'error', description = locale('cannot_use', data.label) })
end

RemoveAllPedWeapons(cache.ped, true)

if currentWeapon then
local weaponSlot = currentWeapon.slot
currentWeapon = Weapon.Disarm(currentWeapon)

if weaponSlot == data.slot then return end
end

GiveWeaponToPed(playerPed, data.hash, 0, false, true)
SetCurrentPedWeapon(playerPed, data.hash, false)

if data.hash ~= GetSelectedPedWeapon(playerPed) then
return lib.notify({ type = 'error', description = locale('cannot_use', data.label) })
end

RemoveWeaponFromPed(cache.ped, data.hash)

useItem(data, function(result)
if result then
currentWeapon = Weapon.Equip(item, data)
Expand Down

0 comments on commit 1c6cce6

Please sign in to comment.