# Table of Contents - [Functions - RX Scripts - Documentation](#functions-rx-scripts-documentation) --- # Functions - RX Scripts - Documentation Inventory Functions ========= Client-side inventory functions supporting 10+ inventory systems. The Inventory adapter provides unified inventory operations across multiple inventory systems. [Functions](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#functions) -------------------------------------------------------------------------------------------- ### [open](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/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](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#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](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#getitemsamounts) Returns a table of item names to total amounts, combining all slots. `FM.inventory.getItemsAmounts()` **Returns:** `table` - 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](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#getitems) Returns all items in the player's inventory. `FM.inventory.getItems()` **Returns:** `table` - 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` * * * ### [getImgDirectory](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#getimgdirectory) Returns the image directory path for item icons. `FM.inventory.getImgDirectory()` **Returns:** `string` - Image directory path **Example:** `local imgDir = FM.inventory.getImgDirectory() print("Item images are located at:", imgDir)` * * * ### [displayMetadata](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#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](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#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](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#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](https://docs.rxscripts.xyz/fmlib/adapters/client/inventory/functions#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)` [Events\ \ Client-side player events that can be listened to for player state changes.](https://docs.rxscripts.xyz/fmlib/adapters/client/player/events) [Functions\ \ Client-side TextUI functions supporting multiple TextUI libraries.](https://docs.rxscripts.xyz/fmlib/adapters/client/textui/functions) ---