From 4fc5e46d0bf95b1774936747b1d5908aef621770 Mon Sep 17 00:00:00 2001 From: BerkieBb <82737367+BerkieBb@users.noreply.github.com> Date: Thu, 23 Jun 2022 21:40:29 +0200 Subject: [PATCH 1/2] fix(client/functions): object amount parameter --- client/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/functions.lua b/client/functions.lua index bf62494..9ab179e 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -26,7 +26,7 @@ function QBCore.Functions.HasItem(items, amount) if isTable then for k, v in pairs(items) do local itemKV = {k, v} - if itemData and itemData.name == itemKV[kvIndex] and ((not amount and not isArray and itemData.amount >= v) or (isArray and amount and itemData.amount >= amount) or (not amount and isArray)) then + if itemData and itemData.name == itemKV[kvIndex] and ((amount and itemData.amount >= amount) or (not isArray and itemData.amount >= v) or (not amount and isArray)) then count += 1 end end From 0b2f3c2a4e9eefca9f9da2ad5b089506fc964e9e Mon Sep 17 00:00:00 2001 From: BerkieBb <82737367+BerkieBb@users.noreply.github.com> Date: Thu, 23 Jun 2022 21:40:59 +0200 Subject: [PATCH 2/2] fix(server/functions): object amount parameter --- server/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/functions.lua b/server/functions.lua index cb2943c..d657ae8 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -387,7 +387,7 @@ function QBCore.Functions.HasItem(source, items, amount) for k, v in pairs(items) do local itemKV = {k, v} local item = Player.Functions.GetItemByName(itemKV[kvIndex]) - if item and ((not amount and not isArray and item.amount >= v) or (isArray and amount and item.amount >= amount) or (not amount and isArray)) then + if item and ((amount and item.amount >= amount) or (not isArray and item.amount >= v) or (not amount and isArray)) then count += 1 end end