Integrations
This section is dedicated to integrations within the script. Here you’ll find connections, adapters, or bridge files that allow the system to interact seamlessly with other Quasar resources or third-party scripts. These integrations ensure better compatibility, data synchronization, and a smoother experience across your server’s ecosystem.
Clear Player Inventory
If you are a qbcore user, ignore this step since your framework will do it automatically. This step is exclusive to esx, but if you want to apply this to other external qbcore assets you can do so.
Quasar Inventory has very useful events when emptying a certain player's inventory. This system will apply, for example, to your esx_ambulancejob but can be used in other assets.
Explanation and way of use
Below we will give a brief summary of the use of the ClearInventory export, which allows us to save some items in the event that it is executed. For example, we can execute it when it dies and it loses all the items, except its id_card or its phone, as in the following example:
Copy
local saveItems = {
'id_card', -- Add here the items that you do NOT want to be deleted
'phone',
}
exports['qs-inventory']:ClearInventory(source, saveItems)Integration in esx_ambulancejob
To clean up inventories after death, we need to make a series of changes to our esx_ambulancejob or use that reference in your ambulancejob resource.
We will apply the changes in the following event RegisterServerCallback esx_ambulancejob:removeItemsAfterRPDeath as follows:
Copy
ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
if Config.RemoveCashAfterRPDeath then
if xPlayer.getMoney() > 0 then
xPlayer.removeMoney(xPlayer.getMoney(), "Death")
end
if xPlayer.getAccount('black_money').money > 0 then
xPlayer.setAccountMoney('black_money', 0, "Death")
end
end
if Config.RemoveItemsAfterRPDeath then
local saveItems = {
'id_card', -- Add here the items that you do NOT want to be deleted
'phone',
}
exports['qs-inventory']:ClearInventory(source, saveItems)
end
if Config.RemoveWeaponsAfterRPDeath then
local weapons = exports['qs-inventory']:GetWeaponList()
for k,v in pairs(weapons) do
xPlayer.removeInventoryItem(v.name, 1 )
end
end
cb()
end)Clothing Items Events
Quasar Inventory now brings a clothing system that was requested by multiple customers in our community, which is based on turning any clothing store into a clothing store with metadata, the metadata will share information between players and each garment will have its own data, allowing us to use different clothes as items.
Exports for clothing use
To use the clothing integration feature, you may need to make a small modification to your clothing system. Many paid clothing systems already include this modification by default, but if not, you can ask the creator of your clothing system for assistance.
Our asset has a loop that continuously checks the player's clothes, ensuring they are always represented as items within the inventory NUI. When opening a clothing store menu, this loop needs to be temporarily stopped using a specific export from our system. Once the menu is closed, the loop can be resumed.
Example: Stopping the clothing loop when opening the store
When you open the clothing store menu, you need to call the export to stop the loop:
-- Event to open the clothing store
RegisterNetEvent('openClothingStore', function()
exports['qs-inventory']:setInClothing(true) -- Stops the clothing loop
TriggerEvent('your-clothing-system:openMenu') -- Replace with your clothing system's open event
end)Example: Resuming the clothing loop when closing the store
When the clothing store menu is closed, you must call the export to resume the loop:
-- Event to close the clothing store
RegisterNetEvent('closeClothingStore', function()
TriggerEvent('your-clothing-system:closeMenu') -- Replace with your clothing system's close event
exports['qs-inventory']:setInClothing(false) -- Resumes the clothing loop
end)Adding Custom Weapons
Add and configure your own custom weapons, attachments, and durability settings directly from the config for full control and flexibility.
To add your own weapons, follow these simple steps carefully:
Create the weapon entry inside
Config.CustomWeaponsfollowing the same structure shown in the example.Use the weapon’s spawn name (for example:
WEAPON_AK47) as the key.Inside it, define all available attachments (clips, scopes, suppressors, etc.) and link each one to the corresponding item name.
You can also adjust weapon durability by changing the numeric value.
Add the weapon and its attachments to both
items.luaandweapons.lua.In
items.lua, include each attachment as a usable item.In
weapons.lua, make sure your weapon name matches exactly the one defined inConfig.CustomWeapons.
Restart the server after saving all changes. Your new custom weapon will now appear in-game with full attachment support and durability handling.
Give Starter Items
Quasar Inventory integrates a small system of starter items which are an edition for esx, since qbcore has them in an automated way. To add starter items we will have to apply some changes to our esx_identity, which we must already have one integrated into our server natively.
Modifications to esx_identify
To integrate the native inventory events on starter items, we will search within our esx_identity/client/main.lua for the following callback, which we will use as a guide.
RegisterNUICallback('register', function(data, cb)Once this callback is detected we will add our own event at the end of the personal registration, leaving something like the example below:
RegisterNUICallback('register', function(data, cb)
if not guiEnabled then
return
end
ESX.TriggerServerCallback('esx_identity:registerIdentity', function(callback)
if not callback then
return
end
ESX.ShowNotification(TranslateCap('thank_you_for_registering'))
TriggerEvent('inventory:client:GiveStarterItems') -- Starter Items
setGuiState(false)
if not ESX.GetConfig().Multichar then
TriggerEvent('esx_skin:playerRegistered')
end
end, data)
end)Once all the steps are ready, we will apply the list of starting items within the inventory in qs-advancedinventory/server/custom/framework/esx.lua, where we will have the complete list as an example by default, remember to add items that you have in your qs- advancedinventory/shared/items.lua.
Stash Integration
The stashes in Quasar Inventory are really useful, smart and simple to integrate into other scripts. This system is completely standalone for both esx and qbcore, follow the following steps to integrate it into your other assets.
Basic Integrations
To integrate a stash, either through export or event, we must have an identification to give to said store, in the case of the examples mentioned it will be lockerID, do not forget to give it the specific value of this identification or use your own identifier for a private stash.
If you want to make a completely personal stash, you can use your player's id as the stash id using client-side ESX.GetPlayerData().identifier.
To integrate stashes we have two methods, the basic event without the use of export which is the simplest to apply or the more complex export which can be used both on the client and on the server.
Don't forget to give the values corresponding to the lockerID example, in that case we must modify it for the identification that we will decide to give to the stash or simply delete it and give it a name.
local other = {}
other.maxweight = 10000 -- Custom weight statsh
other.slots = 50 -- Custom slots spaces
TriggerServerEvent("inventory:server:OpenInventory", "stash", "Stash_"..lockerID, other)
TriggerEvent("inventory:client:SetCurrentStash", "Stash_"..lockerID)Advanced Exports
In the case of wanting to integrate it on the client or server side through a faster export, we can execute either of these two events, depending on your situation.
Client example:
exports['qs-inventory']:RegisterStash("Stash_"..lockerID, 50, 10000) Server example:
exports['qs-inventory']:RegisterStash(source, "Stash_"..lockerID, 50, 10000) Shop Integration
Integration of shops in other assets
You can also make use of the integration of stores in other assets in a simple way, we will leave an example using command of its basic use, then you yourself can easily integrate it as portable stores or static stores using loops on the client side.
RegisterCommand('openshop', function()
local shop = 'shop'
local Items = {
label = 'Simple Shop',
items = {
{
name = "water_bottle",
amount = 99,
price = 15,
slot = 1
},
{
name = "tosti",
amount = 99,
price = 25,
slot = 2
},
},
}
TriggerServerEvent("inventory:server:OpenInventory", "shop", "Itemshop_" .. shop, Items)
end)Petrol Can Integration
This step is not completely mandatory, but we will teach you how to apply metadata to the weapon_petrolcan of assets like LegacyFuel or similar so that they break when you finish filling a certain amount of gasoline in a car.
Quasar Store has an exclusive fuel system called Fuel Stations, which you will find at an exclusive price in our official store. This asset integrates the entire system automatically and has completely impressive functions.
Integration as an example in LegacyFuel
It depends on the version of LegacyFuel you will have to add an event so that it gives you the item since some versions do not bring that natively, use our resource and it will be more functional and faster for you.
The integration is very simple, we will search on the client side for the following code:
SetPedAmmo(ped, 883325847, math.floor(GetAmmoInPedWeapon(ped, 883325847) - fuelToAdd * 100))This event will point us to the point where we should add our custom event, which will be just below it, make sure not to replace the previous event, simply use it as a guide to place the inventory event.
TriggerEvent('inventory:client:LegacyFuel', math.floor(GetAmmoInPedWeapon(ped, 883325847) - fuelToAdd * 100))Steal Players
Quasar Inventory includes a simple system that allows you to open another player’s inventory — useful for actions like searching a suspect, checking a gang member, or inspecting a teammate. This feature can be used in third-party assets, such as police systems, gang scripts, or custom commands.
Code integration
Here is an example of how to trigger another player’s inventory using the event manually.
You must provide the server ID of the nearby player you want to search, along with an optional config indicating which inventory types can be accessed:
RegisterCommand('search', function(source, args, raw)
-- Replace '1' with the player ID you want to search (e.g., from your logic)
TriggerServerEvent('inventory:server:OpenInventory', 'otherplayer', 1, {
type = 'hotbar' -- Options: 'hotbar', 'wallet', or 'all'
})
end)'hotbar': only the hotbar items will be visible.
'wallet': opens wallet-type items (e.g., ID, cards, cash).
'all': full access to the target’s inventory.
You can implement this inside any asset or create your own logic to determine the target player’s ID dynamically.
Non-stealable items
If you want certain items to never be stealable, go to your config.lua and add them under:
Config.noStolenItems = {
'police_badge',
'passport',
'black_card'
}These items cannot be taken from another player's inventory, but they can still be used or dropped manually. That means a player can still drop the item on the ground and give it away, which will not be blocked by the system.
Money Item in QBCORE
Quasar Inventory integrates an advanced money as item system in which you can use money in item format, the system varies depending on qbcore and esx, but here we will focus on the information for qbcore.
How to use in qbcore
This optional system for qbcore can be enabled by running it from server/custom/framework/qb.lua. To do this we will use the configuration that we will see below:
UseCashAsItem = false -- Choose whether to use money as an item
CashItem = 'cash' -- Choose the money item, it only works if I enable the configurable aboveIn this configuration we will place whether or not we want to use this system and below the name of the item that will be the money, in this case it is cash. This item must be added in your qb-core/shared/items.lua.