DirkScripts Logo

Login With FiveM

Login

Server

lib.inventory.useableItem

Register an item as useable with a callback.

lua
lib.inventory.useableItem('bandage', function(source, item)
    print(source, 'used', item.name)
end)
ParameterTypeRequiredDescription
itemNamestringyesItem name
cbfunctionyesCallback function(source, item)
itemtablenoItem data override

lib.inventory.canUseItem

Check if an item has a registered use handler.

lua
local canUse = lib.inventory.canUseItem('bandage')

lib.inventory.addItem

Add an item to an inventory.

lua
local success = lib.inventory.addItem(invId, itemName, count, metadata, slot)
ParameterTypeRequiredDescription
invIdnumber | stringyesPlayer source or stash ID
itemNamestringyesItem name
countnumbernoAmount (default 1)
metadatatablenoItem metadata
slotnumbernoTarget slot

lib.inventory.removeItem

Remove an item from an inventory.

lua
local success = lib.inventory.removeItem(invId, itemName, count, metadata, slot)

Parameters match addItem.

lib.inventory.hasItem

Check if an inventory has an item.

lua
local has = lib.inventory.hasItem(invId, itemName, count, metadata, slot)

lib.inventory.getItems

Get all items in an inventory.

lua
local items = lib.inventory.getItems(invId)

lib.inventory.getItemBySlot

Get the item in a specific slot.

lua
local item = lib.inventory.getItemBySlot(invId, slot)

lib.inventory.getItemByName

Find an item by name in an inventory.

lua
local item = lib.inventory.getItemByName(invId, itemName)

lib.inventory.getItemByMetadata

Find an item by metadata match.

lua
local item = lib.inventory.getItemByMetadata(invId, metadata)

lib.inventory.getItemLabel

Get the display label for an item.

lua
local label = lib.inventory.getItemLabel(item)

lib.inventory.item

Get the full definition of an item.

lua
local itemData = lib.inventory.item(item)

lib.inventory.canCarryItem

Check if an inventory can hold an item.

lua
local canCarry = lib.inventory.canCarryItem(invId, itemName, count, metadata)

lib.inventory.get

Get an inventory object.

lua
local inv = lib.inventory.get(invId)

lib.inventory.clearInventory

Clear all items from an inventory.

lua
lib.inventory.clearInventory(invId)

lib.inventory.registerStash

Register a stash inventory.

lua
lib.inventory.registerStash(invId, data)
ParameterTypeRequiredDescription
invIdstringyesStash identifier
datatableyesStash options (slots, maxWeight, etc.)

lib.inventory.editMetadata

Edit item metadata. Optionally merge instead of replace.

lua
lib.inventory.editMetadata(itemName, metadata, combine)
ParameterTypeRequiredDescription
itemNamestringyesItem name
metadatatableyesNew metadata
combinebooleannoMerge with existing metadata instead of replacing

lib.inventory.setMetadata

Set metadata for a specific inventory slot.

lua
lib.inventory.setMetadata(invId, slot, metadata)

Copyright © 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.