Files
overextended.github.io/docs/ox_inventory/Functions/Server/Inventory/GetItem.md
T
2022-12-11 15:00:43 +11:00

775 B

Returns the item from the specified inventory.

exports.ox_inventory:GetItem(inv, item, metadata, returnsCount)
  • inv: string or number
  • item: table or string
    • Can be items array.
  • metadata?: any
  • returnsCount?: boolean

If returnsCount is set to true, the returned value will be the count based on how many times the item was found.

Otherwise returns the data related to the item and it's total count found in the inventory.

Example:

local item = ox_inventory:GetItem(source, 'water', nil, false)

print(json.encode(item, {indent=true}))
--[[
    {
        "consume": 1,
        "count": 15,
        "stack": true,
        "name": "water",
        "weight": 500,
        "label": "Water",
        "close": true
    }
]]