You can put any items/money types and weapons in your blacklisted inventory items list.
Whitelisted/Blacklisted Areas Configuration
Locations = { ["System"] = "blacklisted", -- Possible Values: whitelisted | blacklisted (Define if you want to blacklisted areas and whitelist the other map locations or whitelist areas and block the other map locations)
["WhitelistedLocations"] = { -- The only locations where loot bags can be dropped { AreaName = "Test1", AreaCoordinates = vector3(0.0, 0.0, 0.0), AreaRange = 10.0 }, -- Area Name is not used, but it is recommended to fill so you know which areas are whitelisted.
{ AreaName = "Test2", AreaCoordinates = vector3(0.0, 0.0, 0.0), AreaRange = 5.0 } -- Area Name is not used, but it is recommended to fill so you know which areas are whitelisted.
}, ["BlacklistedLocations"] = { -- Location that loot bags won't be dropped even if the function is triggered. { AreaName = "Test1", AreaCoordinates = vector3(0.0, 0.0, 0.0), AreaRange = 10.0 }, -- Area Name is not used, but it is recommended to fill so you know which areas are blacklisted.
{ AreaName = "Test2", AreaCoordinates = vector3(0.0, 0.0, 0.0), AreaRange = 5.0 } -- Area Name is not used, but it is recommended to fill so you know which areas are blacklisted.
}, },
Firstly, you must select how the location restriction system will work.
In ["System"] value, change between whitelisted and blacklisted values.
Then, you will add your own blacklisted/whitelisted locations just like the examples above.
Define Lootable Players
IsPlayerLootable=function(playerId) --[[if Config["Framework"] == "ESX" then -- ESX Example: if player is not a simple user and has a permission group then don't drop his loot bag
local xPlayer = ESX.GetPlayerFromId(playerId)if xPlayer.getGroup() ~='user' thenreturnfalseend elseif Config["Framework"] == "QBCore" then -- QBCore Example: if player's permission is admin then don't drop his loot bag
if QBCore.Functions.HasPermission(playerId, 'admin') thenreturnfalseendend--]]returntrueend,
There is already a built-in check which checks if the player is staff. So, when the player is a server's staff the loot bag will not spawn upon his death. You can add your own restrictions there, freely.
Allow/Block Players From Collecting
CanPlayerCollectBag=function() if Config["Framework"] == "ESX" then -- ESX Example: if player is working for ambulance, he can't pick-up the bag.
if ESX.PlayerLoaded thenif ESX.PlayerData.job and ESX.PlayerData.job.name =="ambulance" thenreturnfalseendend elseif Config["Framework"] == "QBCore" then -- QBCore Example: if player is working for ambulance, he can't pick-up the bag.
local PlayerData = QBCore.Functions.GetPlayerData()local jobName = PlayerData.job.nameif jobName =='ambulance' thenreturnfalseendendreturntrue en
There is already a built-in check which checks if the player is working for the ambulance. You can freely remove or change this restriction as was added as an example.