Events & Commands
This page is based on qb-inventory one, since we support almost all their exports to maximize the compatibility between us, qbcore and custom scripts from any developers.
All exports listed are SERVER only unless specified
Basic Events / Triggers
Open Stash:
TriggerServerEvent("inventory:server:OpenInventory", "stash", "myCustomStash", {slots = 15, maxweight = 70000})
TriggerEvent("inventory:client:SetCurrentStash", "myCustomStash")Open Shops:
local ShopItems = {}
ShopItems.label = "myCustomShop"
ShopItems.items = {
[1] = { name = "baggy_empty2", price = 32, amount = 50, info = {}, type = "item", slot = 1, },
[2] = { name = "plantpot", price = 542, amount = 50, info = {}, type = "item", slot = 2, },
[3] = { name = "watering_can", price = 42, amount = 50, info = {}, type = "item", slot = 3, },
[4] = { name = "drug_fertilizer", price = 54, amount = 50, info = {}, type = "item", slot = 4, },
[5] = { name = "rainbowbelts_seed", price = 454, amount = 50, info = {}, type = "item", slot = 5, },
[6] = { name = "cocaine_seed", price = 532, amount = 50, info = {}, type = "item", slot = 6, },
[7] = { name = "watering_can_high", price = 72, amount = 50, info = {}, type = "item", slot = 7, },
[8] = { name = "drug_fertilizer_high", price = 94, amount = 50, info = {}, type = "item", slot = 8, },
}
ShopItems.slots = #ShopItems.items
ShopItems.coords = GetEntityCoords(PlayerPedId())
TriggerServerEvent("inventory:server:OpenInventory", "shop", "myCustomShop", ShopItems)
TriggerEvent("inventory:client:SetCurrentStash", "myCustomShop") Item Info
You can use SetItemData to achieve this
Items support additional information that can be added to them via an info attribute. This information will display on the item when the player hovers over it in a key,value pair format
Example:
Copy
LoadInventory
This function will retrieve the players inventory from the database via their unique identifier aka citizenid
Copy
source:
numbercitizenid:
stringreturns:
table
Copy
SaveInventory
This function saves the players current items to the database
Copy
source:
numberoffline:
boolean
Example:
Copy
ClearInventory
Copy
source:
numberfilterItems:
string | table
Example:
Copy
CloseInventory
Copy
source:
numberidentifier:
string
Example:
Copy
OpenInventory
Copy
source:
numberidentifier:
string | optionaldata:
table | optional
Example:
Copy
OpenInventoryById
Copy
source:
numberplayerId:
number
Example:
Copy
OpenInventoryById will close the target players inventory (if open) and lock it via state. It will then unlock when the opening player closes it
CreateShop
Copy
shopData:
table
Copy
Coords being passed to createShop will be checked against the player's current coords when OpenShopis called if coords were provided during createShop
OpenShop
Copy
source:
numbername:
string
Copy
AddItem
Copy
identifier:
numberitem:
stringamount:
numberslot:
number | booleaninfo:
table | booleanreason:
stringreturns:
boolean
Example:
Copy
RemoveItem
Copy
identifier:
numberitem:
stringamount:
numberslot:
number | booleanreason:
stringreturns:
boolean
Copy
SetInventory
Copy
source:
numberitems:
table
Example:
Copy
SetItemData
This function uses GetItemByName to find the itemName being passed
Copy
source:
numberitemName:
stringkey:
stringval:
string | tablereturns:
boolean
Example:
Copy
Item Info Example:
Copy
UseItem
Copy
itemName:
string. . . :
function
Example:
Copy
HasItem
This export is also available to use on the client
Copy
source:
numberitems:
string | tableamount:
numberreturns:
boolean
Example:
Copy
GetSlotsByItem
Copy
items:
tableitemName:
stringreturns:
table
Example:
Copy
GetFirstSlotByItem
Copy
items:
tableitemName:
stringreturns:
number
Example:
Copy
GetItemBySlot
Copy
source:
numberslot:
numberreturns:
table
Example:
Copy
GetItemByName
Copy
source:
numberitem:
stringreturns:
table
Example:
Copy
GetItemsByName
Copy
source:
numberitem:
stringreturns:
table
Example:
Copy
SetUsage
Copy
state:
bool
Example:
Copy
GetUsageState
Copy
return:
bool
Example:
Copy
GetInventory
Copy
source:
numberreturns:
table
Example:
Copy
CanAddItem
Copy
source:
numberitem:
stringcount:
numberreturns:
bool
Example:
Copy
GetStashItems
Copy
stashID:
stringreturns:
table
Example:
Copy
GetItemDecayHealth
Copy
itemData:
tablereturns:
number
Example:
Copy
EXCLUSIVE EXPORTS JUST FOR ESX!
We need this exports because ESX inventory system, by default, is very simple ( non slots based inventory ), so we need futher mods to it work perfect.
SetPlayerData
Copy
key:
string ("craftingrep", "items")param:
tablesource:
number
Example:
Copy
GetItemList
Copy
returns:
table
Example:
Copy
GetItemLabel
Copy
itemName:
stringreturns:
string
Example:
Copy
CraftLevel
Copy
returns:
number
Example:
Copy
GetInventoryOldFormat
Copy
returns:
DEFAULT_ESX_INVENTORY_TABLE_(converted from jpr to esx format)
Example:
Copy
Last updated