Skip to content

GetInventory

What the player carries, with each item’s condition.

The player’s own items as their game holds them right now: one entry per item or stack, with the item class (a GUID of the game’s tables), the count and the condition in percent as the game’s inventory shows it (0 = broken, 100 = new or fully repaired). The purse is among them as the game’s money item. The list is a copy to read - giving and taking items is the server’s (the game mode’s GivePlayerItem, SetPlayerInventory), and the server knows the same conditions (its GetPlayerInventory).

GetInventory()

table - a list of {class = string, amount = number, health = number}; empty before the player exists

-- a repair menu: how worn is what they carry
for _, item in ipairs(GetInventory()) do
if item.health < 50 then
print(item.class .. " is at " .. item.health .. "%")
end
end

GetPlayerId · the The player, the level and the frame group of the index