Lua/Client/Player/Functions/GetInventory
From JC2-MP Documentation
Returns | table |
---|---|
Prototype | Player:GetInventory() |
Description | Returns the player's inventory as a table of Weapons. |
Contents
Example
Print your inventory when you type 'inventory' in console
function PrintInventory()
local inventory = LocalPlayer:GetInventory()
print("You are carrying "..table.count(inventory).." weapons:")
for slot, weapon in pairs(inventory) do
print("\tSlot "..slot..": "..weapon.id)
end
end
Console:Subscribe("inventory", PrintInventory)
Example output
17:08:45 | [info ] | [sandbox] You are carrying 2 weapons: 17:08:45 | [info ] | [sandbox] Slot 0: 2 17:08:45 | [info ] | [sandbox] Slot 2: 14