Skip to content

Commit

Permalink
refactor(client): show notification when using item while armed
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed May 9, 2024
1 parent e5082f7 commit 081f88d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,13 @@ end
local function useItem(data, cb, noAnim)
local slotData, result = PlayerData.inventory[data.slot]

if not slotData or not canUseItem(data.ammo and true) then return end
if not slotData or not canUseItem(data.ammo and true) then
if currentWeapon then
return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') })
end

return
end

if currentWeapon?.timer and currentWeapon.timer > 100 then return end

Expand Down Expand Up @@ -650,6 +656,10 @@ local function useSlot(slot, noAnim)
useItem(data)
end
end

if currentWeapon then
return lib.notify({ id = 'cannot_perform', type = 'error', description = locale('cannot_perform') })
end
end
exports('useSlot', useSlot)

Expand Down

0 comments on commit 081f88d

Please sign in to comment.