Skip to content

Commit

Permalink
refactor(client): print when weapon is disarmed by game
Browse files Browse the repository at this point in the history
Since we've have a billion issues posted complaining about
default game behaviour.
  • Loading branch information
thelindat committed Sep 1, 2024
1 parent 868eeb3 commit 50a79b0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ local function useSlot(slot, noAnim)
SetCurrentPedWeapon(playerPed, data.hash, false)

if data.hash ~= GetSelectedPedWeapon(playerPed) then
lib.print.info(('%s cannot be used in current context (default game behaviour)'):format(item.name))
return lib.notify({ type = 'error', description = locale('cannot_use', data.label) })
end

Expand Down Expand Up @@ -1393,6 +1394,7 @@ RegisterNetEvent('ox_inventory:setPlayerInventory', function(currentDrops, inven
end

if weaponHash ~= currentWeapon.hash then
lib.print.info(('%s cannot be used in current context (default game behaviour)'):format(currentWeapon.name))
currentWeapon = Weapon.Disarm(currentWeapon, true)
end
end
Expand Down

0 comments on commit 50a79b0

Please sign in to comment.