Quasar Store Logo

Commands and Exports

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.

Commands

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.

CommandDescription
/closeinvCloses the player's inventory instantly.
/inventoryOpens the player's inventory instantly.
/hotbarOpens the player's hotbar instantly.
/handsupRaise your hands and enable the button to draw from said player if you open the inventory.
/searchplayerSearch the nearest player to steal or check their items.
/randomitemsTest 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_giveitemThe interactive menu opens to give items in a personalized way.
/inventoryAddXP [id] [skillCount]Add XP for other players.





Client Exports

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

GetWeaponList

InInventory

setInventoryDisabled

getUserInventory

RegisterStash

setInClothing

WeaponWheel

initCurrentDecorations

Search

CheckIfInventoryBlocked

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.

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.





Server Exports

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

GetWeaponList

GetWeaponAttachmentItems

GetInventory

AddItem

RemoveItem

CanCarryItem

GetItemTotalAmount

GetItemLabel

CreateUsableItem

SetItemMetadata

SetMetaData

GetMetaData

GiveItemToPlayer

GetTotalUsedSlots

local playerSource = 1 -- Replace with the player's source ID local 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

local playerSource = 1 -- Replace with the player's source ID local stashID = "police_armory" -- Unique identifier for the stash local stashSlots = 50 -- Total number of slots available local 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

local stashID = "stash_house" -- Identifier for the stash local itemName = "bread" -- Name of the item to add local itemAmount = 10 -- Quantity of the item local itemSlot = nil -- Specify a slot or use nil for automatic placement local stashSlots = 50 -- Total slots available in the stash local 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

local stashID = "stash_house" -- Identifier for the stash local itemName = "bread" -- Name of the item to remove local itemAmount = 5 -- Quantity of the item to remove local itemSlot = nil -- Specify a slot or use nil for automatic targeting local stashSlots = 50 -- Total slots available in the stash local 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

local stashID = "stash_house" -- Identifier for the stash local stashItems = exports['qs-inventory']:GetStashItems(stashID) if stashItems then for slot, itemData in pairs(stashItems) do print("Slot: " .. slot) print("Item: " .. itemData.name) print("Amount: " .. itemData.amount) end else print("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.

AddToTrunk

exports['qs-inventory']:AddToTrunk('plate', 1, 1, 'sandwich', 1)

This adds the item 'sandwich' to slot 1 of the trunk identified by the vehicle's plate, with a quantity of 1.

RemoveFromTrunk

exports['qs-inventory']:RemoveFromTrunk(source, 'plate', 1, 'sandwich', 1)

This removes the item 'sandwich' from slot 1 of the trunk identified by the vehicle's plate, triggered by the given player source.

ClearOtherInventory

RegisterCommand('clearother', function(source, args, raw) exports['qs-inventory']:ClearOtherInventory('stash', 'inventory_stash_example') end)

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.

UpdateVehiclePlate

exports['qs-inventory']:UpdateVehiclePlate('LI3WDCRV', 'KVT78I33')

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.

RegisterCommand('inventory:registerStash', function(source) local stashId = 'TEST' exports['qs-inventory']:RegisterStash(source, stashId, 50, 10000) end, false)

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.

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)

Usage: /inventory:removeItemFromStash item amount.

inventory:addItemToStash

Adds an item to an existing stash.

RegisterCommand('inventory:addItemToStash', function(source, args) local itemName = args[1] local amount = args[2] local added = exports['qs-inventory']:AddItemIntoStash('Stash_TEST', itemName, amount) end, false)

Usage: /inventory:addItemToStash item amount.