Modifications
Remember that this resource has verified DMCA protection, and its illegal use or distribution could imply a claim for protection of Title 17 of Chapter 512 (c) (3) of the Digital Millennium Copyright Act


Quasar Inventory brings a system to block the use of inventory in a simple and fast way, here we will add an event to block and another to unblock
CLIENT
SERVER
1
TriggerEvent('canUseInventoryAndHotbar:toggle', true) -- Enable
2
TriggerEvent('canUseInventoryAndHotbar:toggle', false) -- Disable
1
TriggerEvent('canHandsUp:toggle', true) -- Enable
2
TriggerEvent('canHandsUp:toggle', false) -- Disable
In the following example we will add an inventory lock to a basic progressbar
1
TriggerEvent('canUseInventoryAndHotbar:toggle', false) -- Disable
2
QS.Progressbar("combine_anim", animText, animTimeout, false, true, {
3
disableMovement = false,
4
disableCarMovement = true,
5
disableMouse = false,
6
disableCombat = true,
7
}, {
8
animDict = aDict,
9
anim = aLib,
10
flags = 16,
11
}, {}, {}, function() -- Done
12
TriggerEvent('canUseInventoryAndHotbar:toggle', true) -- Enable
13
StopAnimTask(PlayerPedId(), aDict, aLib, 1.0)
14
TriggerServerEvent('inventory:server:combineItem', combineData.reward, data.requiredItem, data.usedItem)
15
end, function() -- Cancel
16
TriggerEvent('canUseInventoryAndHotbar:toggle', true) -- Enable
17
StopAnimTask(PlayerPedId(), aDict, aLib, 1.0)
18
end)

This part is for you to learn how to remove items from the inventory such as after death with esx_ambulancejob or with another script that your imagination allows you to modify
We will use esx_ambulancejob as an example, but you can apply the same wherever you want
Whenever we are going to export QS events in another resource, we must add the export of qs-core in line 1, in this case of esx_ambulancejob/server/main.lua
../server/main.lua
1
QS = nil
2
TriggerEvent('qs-core:getSharedObject', function(library) QS = library end)
In the following example, we will remove items from our inventory upon death by looking for the esx_ambulancejob:removeItemsAfterRPDeath event within esx_ambulancejob/server/main.lua
Inside this event, we will declare a GetPlayerFromId as QS, so that it takes the data and information from qs-core, as in the following example
../server/main.lua
1
ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(source, cb)
2
local xPlayer = ESX.GetPlayerFromId(source)
3
local qPlayer = QS.GetPlayerFromId(source)
4
5
if Config.RemoveCashAfterRPDeath then
6
if xPlayer.getMoney() > 0 then
7
xPlayer.removeMoney(xPlayer.getMoney())
8
end
9
10
if xPlayer.getAccount('black_money').money > 0 then
11
xPlayer.removeAccountMoney('black_money', xPlayer.getAccount('black_money').money)
12
end
13
end
14
15
if Config.RemoveItemsAfterRPDeath then
16
qPlayer.ClearInventoryItems()
17
end
18
19
if Config.RemoveWeaponsAfterRPDeath then
20
qPlayer.ClearInventoryWeapons()
21
end
22
23
cb()
24
end)
Value | Information |
---|---|
ClearInventory | Remove items and weapons |
ClearInventoryItems | Remove only the items |
ClearInventoryWeapons | Remove only the weapons |

Quasar Inventory has stashes of all sizes and types, for this we can choose the easy way and create one in the qs-shops configuration, there we can add jobs, sizes and extremely advanced things for each stash
But most likely you will need to add these stashes within other scripts, such as in a housing system or in a job script, so for that we created this section with a small stashes installation guide
To create a basic stash, we need to look for the event where the stash of your external resource is located, in this example we will use esx_property, we look for the part where the inventory is executed and we will enter the following code, which we must vary the stash identifier according to the resource , in this case it is only owner

1
TriggerServerEvent ("inventory:server:OpenInventory", "stash", "Stash_"..owner)
2
TriggerEvent ("inventory:client:SetCurrentStash", "Stash_"..owner)
If you do not have the necessary skills ask for help in the support channel or get a developer with basic Lua experience to correctly execute this step.
For the most advanced and looking to go further than anyone else, they have this option to add advanced stashes, with larger space levels and slots and better configuration
To execute this event, we will do the same as in step
Basic integration
, but integrating the following full eventlocal 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)
You can use the first step of
Basic integration
as a reference to execute this function correctly, the only change is the number of lines that it brings.
Quasar Inventory includes a special event to perform this job, that is, it will be useful for police work or even for your gang factions, you are free to add it wherever you want
The event is for the client side, and it is simply this
1
TriggerServerEvent("inventory:server:OpenInventory", "otherplayer", GetPlayerServerId(closestPlayer))
This code must be implemented within the event with which you plan to steal or search another player's inventory, as in the following example
1
RegisterNetEvent('event:search')
2
AddEventHandler('event:search', function(closestPlayer)
3
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
4
if closestPlayer ~= -1 and closestDistance <= 3.0 then
5
TriggerServerEvent("inventory:server:OpenInventory", "otherplayer", GetPlayerServerId(closestPlayer))
6
end
7
end)

From version 1.4.5 an event was added to give items with metadata and information to the items automatically and easily

The event is simple, but you will only be able to use it on the server side
1
TriggerEvent('qs-inventory:addItem', source, 'lockpick', 1, false, {
2
Firstname = 'Quasar',
3
Lastname = 'Store',
4
showAllDescriptions = true
5
})
You can run a test by command using the following example
1
RegisterCommand('metadatatest', function(source)
2
TriggerEvent('qs-inventory:addItem', source, 'lockpick', 1, false, {
3
Firstname = 'Quasar',
4
Lastname = 'Store',
5
showAllDescriptions = true
6
})
7
end)

To provide greater security to the owners of the servers, a webhook system was recently integrated that will notify you when a house is created, bought or deleted on your server, for this we can find everything in config_discord.lua

Last modified 2mo ago