GetInventory

The GetInventory export allows you to retrieve the inventory of a specific player. This is useful for checking items, quantities, or metadata associated with the items in their inventory.


How to Use

To get a player's inventory, use the following code:

local playerInventory = exports['qs-inventory']:GetInventory(playerSource)

if playerInventory then
    for itemName, itemData in pairs(playerInventory) do
        print("Item Name: " .. itemName)
        print("Quantity: " .. itemData.amount)
        print("Metadata: " .. json.encode(itemData.info))
    end
else
    print("No inventory found for the player.")
end

This will return a table containing all items in the player's inventory, including their quantities and metadata. You can use this data to perform checks, display inventory details, or implement custom logic.

Last updated