RX Scripts Logo
Inventory

Functions

Client-side inventory functions supporting 10+ inventory systems.

The Inventory adapter provides unified inventory operations across multiple inventory systems.

Functions

open

Opens an inventory (player, shop, stash, etc.).

FM.inventory.open(type, id)
type
'otherplayer'|'shop'|'stash'|'drop' required

Inventory type to open

id
string|number required

Target identifier (player ID for otherplayer, shop name, etc.)

Note: Currently only 'otherplayer' is supported for qb-inventory. Other types may vary by inventory system.

Example:

-- Open another player's inventory
local targetId = GetPlayerServerId(PlayerId())
FM.inventory.open('otherplayer', targetId)

openStash

Opens a stash inventory.

FM.inventory.openStash(stashId, owner, weight, slots)
stashId
string|number required

Unique stash identifier

owner
string|boolean

Owner identifier or true for player-owned (optional)

weight
number

Maximum weight capacity (optional, default varies by inventory)

slots
number

Number of slots (optional, default varies by inventory)

Example:

-- Open a personal stash
FM.inventory.openStash("my_stash_123", true, 100000, 50)

-- Open a shared stash
FM.inventory.openStash("gang_stash", false, 200000, 100)

getItemsAmounts

Returns a table of item names to total amounts, combining all slots.

FM.inventory.getItemsAmounts()

Returns: table<string, number> - Table mapping item names to total amounts

Example:

local amounts = FM.inventory.getItemsAmounts()

print("Water bottles:", amounts["water"] or 0)
print("Lockpicks:", amounts["lockpick"] or 0)

-- Check if player has enough items
if amounts["iron"] and amounts["iron"] >= 10 then
    print("Player has enough iron")
end

getItems

Returns all items in the player's inventory.

FM.inventory.getItems()

Returns: table<number, Item> - Table of items indexed by slot

Item Structure:

{
    name = "water",        -- Item name
    label = "Water",       -- Display label
    amount = 5,            -- Item count
    metadata = {}          -- Item metadata (optional)
}

Example:

local items = FM.inventory.getItems()
for slot, item in pairs(items) do
    print(string.format("Slot %d: %s x%d", slot, item.label, item.amount))
end

displayMetadata

Displays item metadata in the inventory UI.

FM.inventory.displayMetadata(metadata)
metadata
table required

Item metadata to display in UI

Example:

FM.inventory.displayMetadata({
    durability = 75,
    serialNumber = "ABC123",
    owner = "John Doe"
})

setWeaponWheel

Enables or disables the weapon wheel.

FM.inventory.setWeaponWheel(state)
state
boolean required

Enable (true) or disable (false) weapon wheel

Example:

-- Disable weapon wheel
FM.inventory.setWeaponWheel(false)

-- Enable weapon wheel
FM.inventory.setWeaponWheel(true)

hasItem

Checks if the player has a specific item.

FM.inventory.hasItem(item)
item
string required

Item name to check

Returns: boolean - True if player has the item

Example:

if FM.inventory.hasItem("lockpick") then
    print("Player has a lockpick")
    -- Start lockpicking minigame
end

Exports

All inventory client functions are available as exports:

exports['fmLib']:inventory_open(type, id)
exports['fmLib']:inventory_openStash(stashId, owner, weight, slots)
exports['fmLib']:inventory_getItemsAmounts()
exports['fmLib']:inventory_getItems()
exports['fmLib']:inventory_displayMetadata(metadata)
exports['fmLib']:inventory_setWeaponWheel(state)
exports['fmLib']:inventory_hasItem(item)