From 9d2488e64d5eae7988889902fa70d870fcde0b41 Mon Sep 17 00:00:00 2001 From: "Alivemonstor [Jayden]" <79489495+Alivemonstor@users.noreply.github.com> Date: Wed, 25 Jun 2025 18:54:48 +0100 Subject: [PATCH 1/2] Update CanAddItem, checks if player has the same item tryna add if inv is full --- server/functions.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/functions.lua b/server/functions.lua index ddc17c9b..28362596 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -391,9 +391,18 @@ function CanAddItem(identifier, item, amount) local slotsUsed, _ = GetSlots(identifier) - if slotsUsed >= inventory.slots then + if slotsUsed >= maxSlots then + for _,v in pairs(items) do + if v.name == itemData.name then + print(('CanAddItem: Player %s has no free slots for item %s, but has %d of it already'):format(identifier, itemData.name, v.amount)) + goto continue + end + end return false, 'slots' end + + ::continue:: + return true end From 8a8534f11e0d1b8a12c55da25f6e2f7d23d81dd4 Mon Sep 17 00:00:00 2001 From: "Alivemonstor [Jayden]" <79489495+Alivemonstor@users.noreply.github.com> Date: Wed, 25 Jun 2025 18:59:41 +0100 Subject: [PATCH 2/2] Accidentally added other code --- server/functions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/functions.lua b/server/functions.lua index 28362596..a7375868 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -391,7 +391,7 @@ function CanAddItem(identifier, item, amount) local slotsUsed, _ = GetSlots(identifier) - if slotsUsed >= maxSlots then + if slotsUsed >= inventory.slots then for _,v in pairs(items) do if v.name == itemData.name then print(('CanAddItem: Player %s has no free slots for item %s, but has %d of it already'):format(identifier, itemData.name, v.amount))