Server Exports

Remember that all exports below are completely optional since Quasar Inventory will use the native events from either esx or qbcore. We do not recommend the use of modifications in the system of adding, removing or creating items in case a standalone use of the asset is not necessary.

Here you will find the list of usable exports for Quasar Inventory, you can use them if you have basic or advanced programming knowledge, we do not recommend using these if you do not have such knowledge, since the inventory will be natively compatible with your framework.

Some of these exports do not work completely for me

If this is the case, please make use of the native events provided by qbcore or esx, as these are fully compatible. These exports are for standalone and advanced development use.


GetItemList

Gets the list of items from your entire shared/items.lua.

-- Get the full table of shared/items.lua
exports['qs-inventory']:GetItemList()

GetWeaponList

Gets the list of weapons from your entire shared/weapons.lua.

-- Get the full table of shared/weapons.lua
exports['qs-inventory']:GetWeaponList()

GetInventory

Check the player's inventory, useful for checking items or meta items.

-- player: Player source or identifier
exports['qs-inventory']:GetInventory(player)

AddItem

Add items with native inventory export (use only for metadata recommended)

-- source: Player source
-- item: Name of the item to deliver
-- count: Quantity of the item to deliver
-- slot: Choose a specific slot or use nil to use the last empty
-- metadata: Insert the metadata you want to give to the item, valid number and string
exports['qs-inventory']:AddItem(source, item, count, slot, metadata)

You can also use it this way if you want to add items without the need for metadata.

-- source: Player source
-- item: Name of the item to deliver
-- count: Quantity of the item to deliver
exports['qs-inventory']:AddItem(source, item, count)

RemoveItem

Delete items items with metadata (use only for metadata recommended)

-- source: Player source
-- item: Name of the item to remove
-- count: Quantity of the item to remove
-- slot: Choose a specific slot or use nil to use the last empty
-- metadata: Insert the metadata you want to give to the item, valid number and string
exports['qs-inventory']:RemoveItem(source, item, count, slot, metadata)

You can also use it in the following way if you want to add items without the need for metadata.

-- source: Player source
-- item: Name of the item to remove
-- count: Quantity of the item to remove
exports['qs-inventory']:RemoveItem(source, item, count)

CanCarryItem

Use it to check whether or not you can carry an item.

-- source: Player source
-- item: Name of the item
-- amount: Quantity of the item
exports['qs-inventory']:CanCarryItem(source, item, amount)

GetItemTotalAmount

Use it to check the total quantity of an item in the inventory.

-- source: Player source
-- item: Name of the item
exports['qs-inventory']:GetItemTotalAmount(source, item)

GetItemLabel

This export will return the label of a specific item.

-- Returns the item label
exports['qs-inventory']:GetItemLabel('tosti')

SetItemMetadata

Used to give metadata to an existing item.

-- player: Player source or identifier
-- slot: Find the item slot or items[item.slot] using GetInventory
-- metadata: Metadata to insert
exports['qs-inventory']:SetItemMetadata(player, slot, metadata)

CreateUsableItem

Create items using QS logic, useful for giving metadata.

-- item: Name of the item you want to create
-- cb: Item creation logic identical to your framework's
exports['qs-inventory']:CreateUsableItem(item, cb)

SetMetaData

Used to deliver specific metadata to the player.

-- player: Player Citizenid or identifier
-- info: Name of the metadata you want to insert
-- metadata: Information of the inserted metadata, valid number and string
exports['qs-inventory']:SetMetaData(player, { info = metadata })

GetMetaData

Check a specific metadata of a player.

-- player: Player identifier
exports['qs-inventory']:GetMetaData(player)

GiveItemToPlayer

Useful to deliver items with metadata, configure it in server/custom.

-- source: Player source
-- item: Name of the item to deliver
-- count: Quantity of the item to deliver
exports['qs-inventory']:GiveItemToPlayer(source, item, count)

GetTotalUsedSlots

Get the used slots in your inventory.

-- source: Player source
exports['qs-inventory']:GetTotalUsedSlots(source)

RegisterStash

Create stashes with a simple export.

-- source: Player source
-- stash: stash identifier
-- slots: Total stash slots
-- weight: Total stash space
exports['qs-inventory']:RegisterStash(source, stash, slots, weight)

AddItemIntoStash

Add items to a stash externally.

-- stashid: Stash id, example 'stash_house'
-- item: item to add, example 'bread'
-- amount: item amount
-- slot: slot or nil
-- info: metadata information or nil
-- slots: stash slots
-- maxWeight: stash weight
exports['qs-inventory']:AddItemIntoStash(stashid, item, amount, slot, info, slots, maxWeight)

RemoveItemIntoStash

Remove items to a stash externally.

-- stashid: Stash id, example 'stash_house'
-- item: item to add, example 'bread'
-- amount: item amount
-- slot: item slot or nil
-- slots: stash slots
-- maxWeight: stash weight
exports['qs-inventory']:RemoveItemIntoStash(stashid, item, amount, slot, slots, maxWeight)

GetStashItems

Check items within a certain stash.

-- stashid: Stash id, example 'stash_house'
exports['qs-inventory']:GetStashItems(stashid)

Last updated