From 1f0ab0a0c41d03c1e51c83855f86fa50aadd878e Mon Sep 17 00:00:00 2001 From: Alexander Grist-Hucker Date: Sun, 19 Aug 2018 23:58:57 +0100 Subject: [PATCH] Fixed inventory.HasItemOfBase and inventory.HasItem returning prematurely. --- gamemode/core/meta/sh_inventory.lua | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gamemode/core/meta/sh_inventory.lua b/gamemode/core/meta/sh_inventory.lua index 605c544f4..586457ee4 100644 --- a/gamemode/core/meta/sh_inventory.lua +++ b/gamemode/core/meta/sh_inventory.lua @@ -342,12 +342,18 @@ function META:HasItem(targetID, data) if (v.uniqueID == targetID) then if (data) then local itemData = v.data + local bFound = true for dataKey, dataVal in pairs(data) do if (itemData[dataKey] != dataVal) then - return false + bFound = false + break end end + + if (!bFound) then + continue + end end return v @@ -364,12 +370,18 @@ function META:HasItemOfBase(baseID, data) if (v.base == baseID) then if (data) then local itemData = v.data + local bFound = true for dataKey, dataVal in pairs(data) do if (itemData[dataKey] != dataVal) then - return false + bFound = false + break end end + + if (!bFound) then + continue + end end return v