Commands and Exports — Advanced Inventory | Quasar Store | Quasar Store
Documentation
Commands and Exports
Every Advanced Inventory (qs-inventory) command, plus the client and server exports, hooks, events and item format for driving the inventory from your own FiveM scripts.
Every player command is a FiveM key mapping, so players can rebind them in GTA's Settings → Key Bindings → FiveM or in the inventory's own Settings → Keys. The starting keys are set in /inventoryconfig → Key binds.
Command
Key
Description
/inventory
TAB
Opens or closes the inventory, with the glovebox, trunk, bag, dumpster or vending machine you are at.
/hotbar
Z
Shows or hides the quick-slot bar. In wheel mode, holding the same key (+quickwheel) opens the quick wheel.
/slot1 … /slot6
1–6
Uses quick slot 1–5; slot6 uses the protected last slot.
/reloadweapon
R
Reloads the weapon in hand from a matching ammo item.
/handsup
X
Raises or lowers your hands, which lets armed players rob you. Only with Hands up on.
inventory:throw
H
Throws the weapon in your hand. Only with throwing on.
/pausemenu
ESC
Opens the inventory's pause menu. ESC is bound only while Replace the GTA pause menu is on.
/searchplayer
—
Searches the closest player within 2.5 m who has their hands up or is dead. Police jobs skip the hands-up rule.
recstop · clipsave · clipdiscard
F9 · — · —
Stop and save, save, or discard a Rockstar Editor clip started from the pause menu.
Admin commands are open to ESX admin / superadmin, QBCore and Qbox god / admin, and the server console. The two panels also accept their own ace — see Claiming Admin Access.
Command
Description
/inventorycreator
Opens the creator. Ace command.inventorycreator by default. The name can be changed in Access & commands.
/inventoryconfig
Opens the settings. Ace command.inventoryconfig by default. The name can be changed in Access & commands.
/giveitem <id> <item> [amount]
Gives an item to a player. ID cards and licences are filled with that player's data. For weapons use /giveweapon.
/giveweapon <id> <weapon> [ammo]
Gives one weapon with a serial and up to 1,000 rounds.
/clearinv [id]
Empties a player's inventory — yours without an id.
/openinventorytarget <id>
Opens another player's inventory, wherever they are.
/repairweapon <quality>
Sets the quality (0–100) of the weapon in your hands. Also needs the ace command.repairweapon.
/resetinv <stash|trunk|glovebox> <id>
Unlocks a container stuck as in use. Its items are kept.
/inventoryAddXP <id> <amount>
Gives a player XP, levelling them up if it is enough.
/randomitems · /dataitem
Testing: ten random items, or a lockpick carrying sample metadata, to yourself.
testwebhooks
Console only. Posts a test to every Discord webhook and prints which ones answered.
For your own client scripts — a HUD that hides while the inventory is open, a job that opens a stash, a minigame that needs an item.
The inventory window
lua
localopen = exports['qs-inventory']:inInventory() -- is it open?
exports['qs-inventory']:closeInventory()
-- Block the inventory, the hotbar and the slot keys (a cutscene, handcuffs...)
exports['qs-inventory']:setInventoryDisabled(true)
local blocked = exports['qs-inventory']:CheckIfInventoryBlocked()
-- Give GTA's weapon wheel back while your script needs it
exports['qs-inventory']:WeaponWheel(true)
-- Open the pause menu on its Information page
exports['qs-inventory']:OpenPauseMenu()
-- Fired on every open (true) and close (false)
AddEventHandler('inventory:setFocus', function(focused)end)
Items the player carries
lua
-- A name, a list of names, or { name = amount }local hasKit = exports['qs-inventory']:HasItem('weapon_repairkit')
local hasAll = exports['qs-inventory']:HasItem({ lockpick = 1, screwdriver = 1 })
local items = exports['qs-inventory']:getUserInventory() -- slot -> itemlocal itemList = exports['qs-inventory']:GetItemList()
-- ox_inventory style: a count, or the slots holding itlocal count = exports['qs-inventory']:Search('count', 'water_bottle')
local slots = exports['qs-inventory']:Search('slots', 'water_bottle')
-- Refreshed after every change
AddEventHandler('inventory:client:inventoryCacheUpdated', function()end)
The same slot table is mirrored in LocalPlayer.state.inventory.
Opening a stash from the client
lua
-- Opens the stash 'Stash_police_locker' with 50 slots and 100 kg
exports['qs-inventory']:RegisterStash('police_locker', 50, 100000, 'Police locker')
-- Or any id, with the server event
TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'gang_safe', { maxweight = 200000, slots = 60 })
TriggerEvent('inventory:client:SetCurrentStash', 'gang_safe') -- so closing saves it
Weights are in grams. Stashes placed in game are better made in the creator, which also handles access by job and gang.
Weapons, blips and look
lua
local weapon = exports['qs-inventory']:GetCurrentWeapon() -- the item in hand: name, info (serie, ammo, quality, attachments)local name = exports['qs-inventory']:getCurrentWeapon() -- just the name, lowercase-- Name your blips on the pause-menu map
exports['qs-inventory']:SetBlipName(blip, 'Weed farm')
local colors = exports['qs-inventory']:getColors() -- the player's interface colours
How another resource drives the inventory — a job reward, a heist, a crafting script, a shop of your own.
Adding and removing items
lua
-- AddItem(source, item, amount, slot, info)local ok = exports['qs-inventory']:AddItem(source, 'water_bottle', 5)
if ok == truethen-- addedend-- With metadata: whatever you put in info travels with the item
exports['qs-inventory']:AddItem(source, 'id_card', 1, nil, {
firstname = 'John',
lastname = 'Doe',
})
-- RemoveItem(source, item, amount, slot)
exports['qs-inventory']:RemoveItem(source, 'lockpick', 1)
-- Check before you givelocal canCarry = exports['qs-inventory']:CanCarryItem(source, 'goldbar', 10)
local fits, reason = exports['qs-inventory']:CanCarryItems(source, { { name = 'goldbar', amount = 10 } })
Compare the result of AddItem with == true: a refusal for weight or a carry limit returns nothing rather than false. Weapons get a serial and full quality on their own, and every item gets a quality of 100 unless you pass one. Every add is recorded in the creator's Stats tab under the name of your resource.
Reading a player's items
lua
local has = exports['qs-inventory']:HasItem(source, 'lockpick') -- or a list, or { name = amount }local total = exports['qs-inventory']:GetItemTotalAmount(source, 'water_bottle')
local item = exports['qs-inventory']:GetItemByName(source, 'phone') -- first matchlocal list = exports['qs-inventory']:GetItemsByName(source, 'phone') -- every matchlocal inSlot = exports['qs-inventory']:GetItemBySlot(source, 3)
local all = exports['qs-inventory']:GetInventory(source) -- slot -> itemlocal used, weight = exports['qs-inventory']:GetTotalUsedSlots(source)
local maxWeight = exports['qs-inventory']:GetPlayerMaxWeight(source) -- carry skills includedlocal label = exports['qs-inventory']:GetItemLabel('water_bottle')
local items = exports['qs-inventory']:GetItemList()
Changing items and inventories
lua
-- Replace the metadata of the item in a slot
exports['qs-inventory']:SetItemMetadata(source, slot, { quality = 50, label = 'Old phone' })
-- Empty an inventory, keeping some items or whole sections
exports['qs-inventory']:ClearInventory(source, { 'id_card', 'phone' })
exports['qs-inventory']:ClearInventoryKeepSections(source, { 'wallet', 'hotbar' })
-- Change an item definition live, for every player
exports['qs-inventory']:UpdateItem('water_bottle', newDefinition)
local serial = exports['qs-inventory']:CreateSerialNumber()
local plate = exports['qs-inventory']:GeneratePlate()
Usable items
lua
exports['qs-inventory']:CreateUsableItem('energy_drink', function(source, item)-- item.name, item.slot, item.info...
exports['qs-inventory']:RemoveItem(source, 'energy_drink', 1, item.slot)
end)
-- Fired whenever any item is used
AddEventHandler('inventory:usedItem', function(itemName, source, itemData)end)
On QBCore it registers through QBCore's own usable items; on ESX the items your other scripts registered with ESX are picked up too. The item must be marked useable.
Opening inventories and shops
lua
-- OpenInventory(name, id, other, source)
exports['qs-inventory']:OpenInventory('stash', 'gang_safe', { maxweight = 200000, slots = 60, label = 'Gang safe' }, source)
exports['qs-inventory']:OpenInventory('otherplayer', targetId, nil, source)
-- A shop of your own, opened as the inventory's Shop page
exports['qs-inventory']:CreateShop({
name = 'mechanic_parts',
label = 'Mechanic Parts',
coords = vector3(-347.0, -133.0, 39.0), -- the player must be within 5 m
account = 'money', -- money, bank, black_money / crypto
restock = 60, -- minutes, for items with stock
items = {
{ name = 'repairkit', price = 250, amount = 1, stock = 20, category = 'Tools' },
{ name = 'tirekit', price = 120 },
},
})
exports['qs-inventory']:OpenShop(source, 'mechanic_parts')
Stashes, trunks and gloveboxes
lua
local items = exports['qs-inventory']:GetStashItems('gang_safe')
exports['qs-inventory']:AddItemIntoStash('gang_safe', 'goldbar', 5)
exports['qs-inventory']:RemoveItemIntoStash('gang_safe', 'goldbar', 2)
local fits = exports['qs-inventory']:StashCanCarryItem('gang_safe', 'goldbar', 5, 60, 200000)
-- 'stash', 'trunk' or 'glovebox'local trunk = exports['qs-inventory']:GetOtherInventoryItems('trunk', plate)
exports['qs-inventory']:ClearOtherInventory('glovebox', plate)
-- A plate change keeps the trunk and glovebox
exports['qs-inventory']:UpdateVehiclePlate(oldPlate, newPlate)
Stashes opened with are stored as — use that full id with these exports.
XP, levels and missions
lua
local skill = exports['qs-inventory']:GetSkill(source) -- { level = 4, xp = 120 }
exports['qs-inventory']:AddExperience(source, 250) -- call it from a thread-- Progress a mission of type From another script (adds, capped at 100)
exports['qs-inventory']:UpdateQuestProgress(source, 'deliver_packages', 20)
AddEventHandler('inventory:updateLevel', function(source, level)end)
AddEventHandler('inventory:questFinished', function(source, questName)end)
The creator's mission form shows the exact UpdateQuestProgress line for each scripted mission, ready to copy.
Weapons, creator records and player data
lua
local weapon = exports['qs-inventory']:GetCurrentWeapon(source) -- the weapon item in that player's handslocal shops = exports['qs-inventory']:GetCreatorRecords('shop') -- stash, shop, crafting, seller, item, weaponlocal trading = exports['qs-inventory']:IsPlayerTrading(source)
-- A small key/value store per player, kept by the inventorylocal data = exports['qs-inventory']:GetMetaData(identifier)
exports['qs-inventory']:SetMetaData(identifier, { armor = 50 })
AddEventHandler('inventory:addAttachment', function(source, item, component, kind, tint)end)
AddEventHandler('weapons:weaponRepaired', function(source, weaponName, label, ammotype)end)
A hook runs your function when something happens in the inventory. The one fired today is buyItem, after every successful shop purchase — money taken, item given:
lua
exports['qs-inventory']:registerHook('buyItem', function(payload)-- payload.source, payload.itemName, payload.amount-- payload.info / payload.metadata (the item's metadata)-- payload.externalMeta.shopType (the shop it came from)end)
-- When your resource stops, remove it yourself
AddEventHandler('onResourceStop', function(res)if res == GetCurrentResourceName() then
exports['qs-inventory']:unregisterHook('buyItem')
endend)
Each resource has one function per hook; registering again replaces it. The purchase has already happened when the hook runs, so it cannot cancel it — keep it short and error-free.
Items made in the creator need no code. For lists kept in shared/items.lua (ESX and Qbox) or qb-core/shared/items.lua (QBCore), this is the format, taken from the shipped grilled cheese sandwich:
lua
['tosti'] = {
['name'] = 'tosti',
['label'] = 'Grilled Cheese Sandwich',
['weight'] = 200, -- grams
['type'] = 'item', -- or 'weapon'
['image'] = 'tosti.png',
['unique'] = false, -- true: one per slot
['useable'] = true,
['shouldClose'] = true, -- close the inventory on use
['description'] = 'Nice to eat',
['decay'] = 0.07, -- days from 100% to 0%
['delete'] = false, -- remove it when broken
['object'] = 'prop_sandwich_01', -- prop on the ground and when thrown
['disableThrow'] = true,
['client'] = {
status = { hunger = 200000 },
usetime = 2500,
anim = { dict = 'mp_player_inteat@burger', clip = 'mp_player_int_eat_burger_fp' },
prop = { model = 'prop_cs_burger_01', pos = vec3(0.02, 0.02, -0.02), rot = vec3(0.0, 0.0, 0.0) },
disable = { move = true, car = true, mouse = false, combat = true },
removeAfterUse = true,
},
},
Optional field
What it does
rare
common, epic or legendary — the colour of the slot and card, and what rarity missions count.
combinable
{ accept = { items }, reward = 'item', anim = { dict, lib, text, timeOut } } — dropping an accepted item on it makes the reward.
job
A list of jobs allowed to use it.
useableIn
'hotbar', 'inventory' or 'wallet' — where it must sit to be used.
level
The player level needed to use it (with the Missions page on).
client.export
'resource.exportName' — a client export called when it is used.
client.status
hunger and thirst in ESX's scale (200000 = 20%), stress from −100 to 100.
A weapon needs an item of type = 'weapon' with its ammotype (AMMO_PISTOL, AMMO_RIFLE…), and an entry in the weapon list:
The event prefix. Events written here as inventory:… use the default prefix. If a developer changed Event prefix in the advanced settings, the inventory:server:… and inventory:client:… events change with it — which is why it should stay inventory.
OpenInventory is trusted: it skips the distance and robbery checks, so call it only after your own. A shop can also take locations, a license item, categories and groups (the jobs allowed, each with the grade a player must be above); each product can take jobs, license and attachments. Scripts can also trigger inventory:openShop with the shop name from the client.