This section lists all available commands, exports, and events included in the script. You’ll find client-side, server-side, and shared functions designed to help developers integrate, extend, or interact with the system easily within their own scripts or frameworks.
This section lists all available commands included in the script. Each command is designed to simplify administration, player interaction, or debugging tasks. You’ll find detailed descriptions, usage examples, and permission requirements to help you manage and customize your server efficiently.
Command
Description
/closeinv
Closes the player's inventory instantly.
/inventory
Opens the player's inventory instantly.
/hotbar
Opens the player's hotbar instantly.
/handsup
Raise your hands and enable the button to draw from said player if you open the inventory.
/searchplayer
Search the nearest player to steal or check their items.
/randomitems
Test command that will give you a random amount of items, used for general testing.
/resetinv [id]
Resets the selected player's inventory.
/clearinv [id]
Clears the selected player's inventory and leaves it completely empty.
/giveitem [id] [item] [count]
Deliver items to a specific player, selecting his id, item name and quantity.
/giveweapon [id] [weapon] [ammo]
Deliver only weapons, you must select the id, weapon and number of ammo.
/repairweapon [id]
Repairs the weapons of the selected player through his id, all weapons go to 100% durability.
/openinventorytarget [id]
Administrative command to check the inventory of a target player.
/admin_giveitem
The interactive menu opens to give items in a personalized way.
This section provides all available client exports for the script. These functions allow you to interact directly with the system from the client side, enabling custom features, UI interactions, and integrations with other resources. Each export includes a short description and usage example for easy implementation.
GetItemList
lua
local itemList = exports['qs-inventory']:GetItemList()
for itemName, itemData inpairs(itemList) doprint("Item Name: " .. itemName)
print("Label: " .. itemData.label)
print("Weight: " .. itemData.weight)
end
This will return a table containing all the items and their properties, such as name, label, weight, type, and more. You can use this data to interact with or display item details dynamically in your scripts.
GetWeaponList
lua
local weaponList = exports['qs-inventory']:GetWeaponList()
for weaponName, weaponData inpairs(weaponList) doprint("Weapon Name: " .. weaponName)
print("Label: " .. weaponData.label)
end
This will return a table containing all the weapons and their properties, such as name, label, damage, and more. You can use this data to interact with or display weapon details dynamically in your scripts.
InInventory
lua
local isInventoryOpen = exports['qs-inventory']:inInventory()
if isInventoryOpen thenprint("The inventory is currently open.")
elseprint("The inventory is closed.")
end
This will return true if the inventory is open and false if it is closed. You can use this information to control other systems or restrict specific actions while the inventory is in use.
This export uses a boolean value to control whether the inventory can be opened or not. When set to true, the inventory becomes disabled and players will not be able to open it. When set to false, the inventory is enabled again and can be accessed normally. This is useful when you need to temporarily block inventory access while another system, animation, or menu is active.
getUserInventory
lua
local inventory = exports['qs-inventory']:getUserInventory()
for itemName, itemData inpairs(inventory) doprint("Item Name: " .. itemName)
print("Amount: " .. itemData.amount)
end
This will return a table of items with their quantities, making it easy to access and manipulate the player's inventory programmatically. Use this to search for specific items, display inventory details, or validate item counts.
RegisterStash
lua
-- Example stash configurationlocal stashID = "example_stash"-- Unique identifier for the stashlocal stashSlots = 50-- Total number of slotslocal stashWeight = 1000-- Maximum weight capacity
exports['qs-inventory']:RegisterStash(stashID, stashSlots, stashWeight)
print("Stash registered: " .. stashID)
This export is used to create a stash dynamically by defining a few key values. The stash parameter acts as a unique identifier for the storage, such as "police_armory", allowing the system to recognize it. The slots value determines how many item spaces the stash will contain, while weight defines the total storage capacity allowed. This makes it ideal for creating custom storage systems like private lockers, organization storage, or job-specific containers directly from your scripts.
setInClothing
lua
-- Enable the clothing loop
exports['qs-inventory']:setInClothing(true)
-- Disable the clothing loop
exports['qs-inventory']:setInClothing(false)
This ensures that clothing items are correctly tracked when the loop is enabled and prevents conflicts by pausing the loop when disabled, such as during the use of a clothing menu.
WeaponWheel
lua
-- Enable the Weapon Wheel
exports['qs-inventory']:WeaponWheel(true)
-- Disable the Weapon Wheel
exports['qs-inventory']:WeaponWheel(false)
This export is designed specifically for enabling the Weapon Wheel in controlled environments, such as mini-games, and should not be used as a replacement for the standard inventory weapon system.
initCurrentDecorations
lua
local weapon = exports['qs-inventory']:GetCurrentWeapon()
if weapon thenprint("Current Weapon: " .. json.encode(weapon))
elseprint("No weapon equipped.")
end
Here’s an example of using this export to check the durability of a weapon:
This command retrieves the weapon currently in use, prints its information, and displays its durability. It’s a simple and flexible way to interact with weapon data during gameplay.
Search
lua
local result = exports['qs-inventory']:Search('item_name')
if result thenprint("Item found! Quantity:", result)
elseprint("Item not found.")
end
Here’s an example of a command that checks if the player has a specific item, like "money":
lua
RegisterCommand('checkclientitem', function()local result = exports['qs-inventory']:Search('money')
if result thenprint('Result: Player has', result, 'money.')
elseprint('Result: Player does not have money.')
endend)
This example checks for the "money" item in the player’s inventory and prints the result. If the item is found, it will return the quantity; otherwise, it will return nil.
CheckIfInventoryBlocked
javascript
local isBlocked = exports['qs-inventory']:CheckIfInventoryBlocked()
if isBlocked then
print("Inventory is blocked.")
elseprint("Inventory is not blocked.")
end
Here’s an example of a command that checks if the player's inventory is blocked:
lua
RegisterCommand('checkinventory', function()local isBlocked = exports['qs-inventory']:CheckIfInventoryBlocked()
if isBlocked thenprint("Result: Inventory is currently blocked.")
elseprint("Result: Inventory is not blocked and can be used.")
endend)
This example checks if the inventory is blocked when using the /checkinventory command. If the inventory is blocked, it will print a corresponding message; otherwise, it will confirm that the inventory is usable.
inventory:server:OpenInventory and inventory:client:SetCurrentStash
Below you can find the server-side function that continues this guide. Opens stash from the client and sets it as the current active stash.
lua
local stashId = 'TEST'
TriggerServerEvent('inventory:server:OpenInventory', 'stash', stashId)
TriggerEvent('inventory:client:SetCurrentStash', stashId)
The stashId must exactly match the identifier that was registered on the server, otherwise the system will not be able to find the correct stash. Additionally, the stash must already exist before attempting to open it; if it has not been created or registered beforehand, the inventory will simply fail to open.
This section provides all available server exports for the script. These functions allow developers to interact with the system from the server side, manage data, trigger actions, and integrate with other resources. Each export includes a clear description and a practical example to simplify its implementation.
GetItemList
lua
local itemList = exports['qs-inventory']:GetItemList()
for itemName, itemData inpairs(itemList) doprint("Item Name: " .. itemName)
print("Label: " .. itemData.label)
print("Weight: " .. itemData.weight)
end
This will return a table containing all the items and their properties, such as name, label, weight, type, and more. You can use this to interact with or display item details dynamically in your scripts.
GetWeaponList
To listen for rent payment events in your script, use the following pattern:
lua
local weaponList = exports['qs-inventory']:GetWeaponList()
for weaponName, weaponData inpairs(weaponList) doprint("Weapon Name: " .. weaponName)
print("Label: " .. weaponData.label)
end
This will return a table containing all the weapons and their properties, such as name, label, damage, and more. You can use this to interact with or display weapon details dynamically in your scripts.
GetWeaponAttachmentItems
lua
local attachmentList = exports['qs-inventory']:GetWeaponAttachmentItems()
for _, attachment inpairs(attachmentList) doprint("Item: " .. attachment.item)
print("Attachment Type: " .. attachment.type)
print("Attachment ID: " .. attachment.attachment)
end
This export returns a table containing all available weapon attachments and their related data. Each entry includes information such as the inventory item name, the internal attachment ID used by the weapon system, and the attachment type (for example suppressor, clip, scope, tint, or flashlight). Some attachments may also include optional properties like tint values, labels, or flags indicating whether they apply to every weapon or use a URL tint.
With this export, you can easily retrieve attachment data to build custom weapon customization interfaces, validate attachment items, or extend your weapon system with additional functionality.
GetInventory
lua
local inventory = exports['qs-inventory']:GetInventory(playerSource)
if inventory thenfor slot, item inpairs(inventory) doprint("Slot: " .. slot)
print("Item Name: " .. item.name)
print("Quantity: " .. item.amount)
print("Metadata: " .. json.encode(item.info))
endelseprint("No inventory found for this player.")
end
This returns a table where each key represents a slot number, and each value contains the item's data (name, amount, info, etc.). You can use this structure to validate items, read specific metadata, or apply your own custom logic.
AddItem
The AddItem export allows you to add items to a player’s inventory programmatically. It is especially useful when you need to give items that include metadata, but it can also be used for simple item additions without any extra data.
However, we generally recommend using the AddItem and RemoveItem functions provided by the framework you are using (such as ESX or QB). These functions are usually better integrated with the rest of the framework systems and help maintain compatibility with other resources.
If no metadata is required, you can use this simpler version:
lua
local playerSource = 1-- Replace with the player's source IDlocal itemName = "water_bottle"local itemCount = 5
exports['qs-inventory']:AddItem(playerSource, itemName, itemCount)
This export allows you to give an item to a player by specifying several parameters. The source represents the player’s source ID, while item defines the name of the item that will be added. The count determines how many units of that item the player will receive. You can optionally define a slot to place the item in a specific inventory position, or use nil so the system automatically places it in the next available slot. It is also possible to include metadata, which allows you to attach custom data such as quality, expiration time, or other attributes. This makes the export very flexible for dynamically creating items or assigning special properties when needed.
RemoveItem
The RemoveItem export allows you to remove items from a player's inventory. It is particularly useful for managing items with metadata but can also be used to remove items without metadata.
However, we generally recommend using the AddItem and RemoveItem functions provided by the framework you are using (such as ESX or QB). These functions are usually better integrated with the rest of the framework systems and help maintain compatibility with other resources.
If metadata is not needed, you can use this simpler version:
lua
local playerSource = 1-- Replace with the player's source IDlocal itemName = "water_bottle"local itemCount = 2
exports['qs-inventory']:RemoveItem(playerSource, itemName, itemCount)
This export allows you to remove items from a player’s inventory by defining a few parameters. The source represents the player’s source ID, while item specifies the name of the item that should be removed. The count determines how many units of that item will be taken from the inventory. You can optionally define a slot to target a specific inventory slot, or use nil so the system removes the item from any available slot that matches. It is also possible to include metadata to ensure the system removes the exact item that matches certain attributes. This makes the export flexible for both basic item removal and more advanced cases where items contain specific metadata.
CanCarryItem
lua
local playerSource = 1-- Replace with the player's source IDlocal itemName = "water_bottle"local itemCount = 5local canCarry = exports['qs-inventory']:CanCarryItem(playerSource, itemName, itemCount)
if canCarry thenprint("Player can carry the item.")
elseprint("Player cannot carry the item.")
end
This will return true if the player has enough space for the specified item and false if not.
GetItemTotalAmount
lua
local playerSource = 1-- Replace with the player's source IDlocal itemName = "water_bottle"local totalAmount = exports['qs-inventory']:GetItemTotalAmount(playerSource, itemName)
print("Total amount of " .. itemName .. ": " .. totalAmount)
This will return the total number of the specified item in the player's inventory.
GetItemLabel
lua
local itemLabel = exports['qs-inventory']:GetItemLabel('tosti')
print("Item Label: " .. itemLabel)
This will return the label associated with the specified item.
CreateUsableItem
The CreateUsableItem export allows you to create usable items using QS logic, making it ideal for adding metadata or custom functionality. However, it is generally recommended to use the CreateUsableItem function provided by your framework (ESX or QB) whenever possible for better compatibility.
lua
local itemName = "water_bottle"
exports['qs-inventory']:CreateUsableItem(itemName, function(source, item)print("Player used item: " .. item.name)
-- Add your custom logic hereif item.metadata and item.metadata.quality thenprint("Item quality: " .. item.metadata.quality)
endend)
This creates a usable item and attaches the specified logic to it, allowing for dynamic behavior based on item properties or metadata.
SetItemMetadata
lua
local playerSource = 1-- Replace with the player's source IDlocal itemSlot = 2-- Replace with the item's slotlocal itemMetadata = { quality = 100, expiry = "2025-01-01" }
exports['qs-inventory']:SetItemMetadata(playerSource, itemSlot, itemMetadata)
print("Metadata updated for item in slot: " .. itemSlot)
This assigns the specified metadata to the item in the given inventory slot.
SetMetaData
lua
local playerIdentifier = "Player_CitizenID"-- Replace with the player's CitizenID or identifierlocal metaInfo = "player_rank"local metaValue = "Elite"
exports['qs-inventory']:SetMetaData(playerIdentifier, { [metaInfo] = metaValue })
print("Metadata '" .. metaInfo .. "' set to: " .. metaValue)
This assigns the specified metadata (metaInfo) with the given value (metaValue) to the player, allowing for flexible customizations.
GetMetaData
lua
local playerIdentifier = "Player_CitizenID"-- Replace with the player's identifierlocal metaData = exports['qs-inventory']:GetMetaData(playerIdentifier)
if metaData thenprint("Player Metadata: " .. json.encode(metaData))
elseprint("No metadata found for the player.")
end
This retrieves and prints the metadata associated with the specified player, providing flexibility for custom logic and features.
GiveItemToPlayer
lua
local playerSource = 1-- Replace with the player's source IDlocal itemName = "water_bottle"local itemCount = 5
exports['qs-inventory']:GiveItemToPlayer(playerSource, itemName, itemCount)
print("Gave " .. itemCount .. " " .. itemName .. " to player.")
This delivers the specified item and quantity to the targeted player's inventory. You can expand the functionality by adding metadata configurations in server/custom.
GetTotalUsedSlots
lua
local playerSource = 1-- Replace with the player's source IDlocal usedSlots = exports['qs-inventory']:GetTotalUsedSlots(playerSource)
print("Total used slots: " .. usedSlots)
This returns the total number of inventory slots that are occupied by items for the specified player.
RegisterStash
lua
local playerSource = 1-- Replace with the player's source IDlocal stashID = "police_armory"-- Unique identifier for the stashlocal stashSlots = 50-- Total number of slots availablelocal stashWeight = 1000-- Maximum weight capacity of the stash
exports['qs-inventory']:RegisterStash(playerSource, stashID, stashSlots, stashWeight)
print("Stash registered: " .. stashID)
This creates a stash with the specified identifier, number of slots, and weight capacity for the specified player. Stashes can be used for custom storage solutions like personal lockers or organizational armories.
AddItemIntoStash
lua
local stashID = "stash_house"-- Identifier for the stashlocal itemName = "bread"-- Name of the item to addlocal itemAmount = 10-- Quantity of the itemlocal itemSlot = nil-- Specify a slot or use nil for automatic placementlocal stashSlots = 50-- Total slots available in the stashlocal stashMaxWeight = 1000-- Maximum weight capacity of the stash
exports['qs-inventory']:AddItemIntoStash(stashID, itemName, itemAmount, itemSlot, nil, stashSlots, stashMaxWeight)
print("Added " .. itemAmount .. " " .. itemName .. " to stash: " .. stashID)
This export enables you to manage stashes efficiently by dynamically adding items while respecting the stash's slot and weight limitations.
RemoveItemIntoStash
lua
local stashID = "stash_house"-- Identifier for the stashlocal itemName = "bread"-- Name of the item to removelocal itemAmount = 5-- Quantity of the item to removelocal itemSlot = nil-- Specify a slot or use nil for automatic targetinglocal stashSlots = 50-- Total slots available in the stashlocal stashMaxWeight = 1000-- Maximum weight capacity of the stash
exports['qs-inventory']:RemoveItemIntoStash(stashID, itemName, itemAmount, itemSlot, stashSlots, stashMaxWeight)
print("Removed " .. itemAmount .. " " .. itemName .. " from stash: " .. stashID)
This export ensures efficient management of stash contents by removing specified items while respecting slot and weight parameters.
GetStashItems
lua
local stashID = "stash_house"-- Identifier for the stashlocal stashItems = exports['qs-inventory']:GetStashItems(stashID)
if stashItems thenfor slot, itemData inpairs(stashItems) doprint("Slot: " .. slot)
print("Item: " .. itemData.name)
print("Amount: " .. itemData.amount)
endelseprint("No items found in stash: " .. stashID)
end
This retrieves all items in the specified stash, including their slot, name, and quantity, for further processing or display.
This command clears the stash identified by the name 'inventory_stash_example'. The first parameter 'stash' indicates the inventory type (it could be 'trunk', 'glovebox', etc.). Once executed, all items inside that stash will be permanently removed.
This function replaces the old plate 'LI3WDCRV' with the new one 'KVT78I33'.
The first parameter is the current plate of the vehicle, and the second parameter is the new plate you want to assign.
Once executed, any inventory or storage data linked to the old plate will now be reassigned to the new one, maintaining consistency and preventing data conflicts.
inventory:registerStash
Registers a stash linked to the player who executes the command.
source is the player source registering the stash, stashId is the unique identifier of the stash, 50 represents the number of available slots, and 10000 defines the maximum weight the stash can hold.
inventory:removeItemFromStash
Removes a specific item from an existing stash.
lua
RegisterCommand('inventory:removeItemFromStash', function(source, args)local itemName = args[1]
local amount = args[2]
local removed = exports['qs-inventory']:RemoveItemIntoStash('Stash_TEST', itemName, amount)
end, false)