add new function hasFreeInventorySlots()

using the function to grab slot info, this can now check if you have enough inventory slots for items to be given, allowing it to check before TRYING to add them
This commit is contained in:
Jim Shield
2025-06-26 20:04:32 +01:00
parent f3fa309dbf
commit 5c69f8dd28

View File

@@ -870,6 +870,18 @@ function getCurrentInvWeight()
return weight return weight
end end
function hasFreeInventorySlots(slots, src)
local inv = getPlayerInv(src)
print(countTable(inv))
print(countTable(inv) + slots)
print(InventorySlots)
print((countTable(inv) + slots) <= InventorySlots)
if (countTable(inv) + slots) <= InventorySlots then
return true
end
return false
end
------------------------------------------------------------- -------------------------------------------------------------
-- Check Item Existance - return boolean(true,false) -- Check Item Existance - return boolean(true,false)
------------------------------------------------------------- -------------------------------------------------------------