Skip to content

Commit bd66a05

Browse files
Merge pull request #626 from Alivemonstor/patch-3
Update CanAddItem function
2 parents 7feaf52 + 8a8534f commit bd66a05

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

server/functions.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,17 @@ function CanAddItem(identifier, item, amount)
392392
local slotsUsed, _ = GetSlots(identifier)
393393

394394
if slotsUsed >= inventory.slots then
395+
for _,v in pairs(items) do
396+
if v.name == itemData.name then
397+
print(('CanAddItem: Player %s has no free slots for item %s, but has %d of it already'):format(identifier, itemData.name, v.amount))
398+
goto continue
399+
end
400+
end
395401
return false, 'slots'
396402
end
403+
404+
::continue::
405+
397406
return true
398407
end
399408

0 commit comments

Comments
 (0)