From 081f88d6648f7e22e14bb5724e9def1d9e5567c6 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 10 May 2024 06:44:10 +1000 Subject: [PATCH] refactor(client): show notification when using item while armed --- client.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client.lua b/client.lua index a0c7f11389..d8bcbe3bed 100644 --- a/client.lua +++ b/client.lua @@ -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 @@ -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)