FiveM Loot Bag Script
- This script creates loot bags containing a player’s inventory when they die. Other players can interact with the bag and the loot can be taken one item at a time or all at once. The script supports configurable options like restricting loot to the bag owner or allowing anyone to loot, customizing death events, and zones where only the owner can loot.
Features
-
Creates a loot bag when a player dies, containing all their inventory items.
-
Allows players to interact with the bag via
ox_targetand loot items usingox_lib. -
Option to loot items one by one without or All at ones.
-
Configurable zones where only the player who died can loot the bag.
-
Configurable despawn time for the loot bag.
Dependencies
-
ESX and other qb-version
-
ox_target
-
ox_lib
-
ox_inventory
Config
Config = {}
Config.Framework = 'auto' -- 'auto' | 'qb' | 'esx'
Config.QB = {
CoreResource = 'qb-core', -- file name
DeathEvent = 'hospital:server:SetDeathStatus', -- death event
}
Config.ESX = {
CoreResource = 'es_extended', -- file name
DeathEvent = 'esx:onPlayerDeath', -- death event
}
-- blips related
Config.BlipSettings = {
sprite = 306,
color = 1,
scale = 0.8,
name = "Death Location"
}
-- pickup
Config.Carry = {
enable = true,
pickupLabel = 'Pick up bag',
dropLabel = 'Drop bag',
useTextUI = true,
dropText = '[E] Drop bag',
dropKey = 38, -- E
textPosition = 'right-center', -- ox_lib positions
bone = 28422, -- SKEL_R_Hand
pos = vector3(0.26, 0.04, 0.0),
rot = vector3(90.0, 0.0, -78.98),
-- Restrictions while carrying
disableCombat = true,
disableSprint = false,
disableJump = false,
}
-- basic antiexploit for pickup
Config.Security = {
enableDistanceCheck = true,
maxDistance = 3.0, -- max distance allowed for pickup/loot
}
-- Animations (set enable=false to disable all)
Config.Animations = {
enable = true,
pickup = { dict = 'pickup_object', anim = 'pickup_low', duration = 900, flag = 48 },
drop = { dict = 'pickup_object', anim = 'putdown_low', duration = 900, flag = 48 },
search = { dict = 'amb@prop_human_bum_bin@base', anim = 'base', duration = 2000, flag = 49 },
}
-- Progress bars "ox_lib"
Config.Progress = {
enable = true,
type = 'circle', -- 'bar' | 'circle'
circlePosition = 'middle', -- progress "Circle" position
pickupLabel = 'Picking up bag...',
dropLabel = 'Dropping bag...',
searchLabel = 'Searching bag...',
}
-- Owner zones
Config.Owner = {
enable = false,-- false: everyone can loot, but inside Owner.zones only the owner can loot
zones = { -- zones where only owner can loot when Owner.enable = false
['1'] = {vector3(-581.78, -166.96, 39.74), radius = 50.0},
['2'] = {vector3(-413.83, 1173.76, 337.04), radius = 120.0},
['3'] = {vector3(360.76, -1590.5, 36.95), radius = 90.0},
['4'] = {vector3(2048.74, 3418.85, 49.0), radius = 80.0}
}
}
-- Restrict zones
Config.Restrict = {
enable = false, -- false: loot bags spawn globally , true: loot bags ONLY spawn inside Restrict.zones
zones = { -- areas where death loot will work if Restrict.enable = true
['1'] = {vector3(738.75, 1286.77, 360.3), radius = 50.0},
['2'] = {vector3(624.43, 1856.72, 196.42), radius = 40.0}
}
}
-- Items that will not be added to the bag (they just get deleted on death).
Config.BlacklistedItems = {
'id_card',
'driver_license'
-- add more if needed
}
-- translate
Config.translate = {
cant_loot = "You can't loot this bag.",
space = "Not enough space for this item.",
all_item_space = "Not enough space to take all items. Please loot individually.",
too_far = "You're too far away from the bag.",
already_carried = "This bag is already being carried.",
carry_one = "You can only carry one bag at a time.",
}
-- other settings
Config.discordhook = "ur_webhook_here"
Config.Print = true -- Debug print
Config.Target_script = 'qb-target' -- "qb-target" or "ox_target"
Config.Menu_script = 'ox_lib' -- "qb-menu" or "ox_lib" or "sinor-menu"
Config.inventory = 'qb-inventory' -- "ox_inventory" or "qb-inventory"
Config.icon_path = 'nui://qb-inventory/html/images/' -- for qb 'nui://qb-inventory/html/images/' or ox 'nui://ox_inventory/web/images/'
Config.DeathEvent = 'auto' -- 'auto' picks from Config.QB/Config.ESX
Config.LootBagModel = "bkr_prop_duffel_bag_01a" -- Loot bag model (old bag model = 'prop_cs_heist_bag_02')
Config.LootBagDespawnTime = 30 -- in minuts
Config.label = 'Search Bag' -- Interaction label
Config.InteractionDistance = 2.5 -- Interaction distance
Config.RemoveBagAfterLooted = false -- Remove bag after emptied
Events
esx:onPlayerDeath: The script listens for this event to trigger loot bag creation. Modify the Config.DeathEvent if you use a different event for handling player deaths.
Preview
tebex : Here
Other Scripts
QBCore/ESX|BaseBuilding
Standalone|AdvancedZombieSystem
Standalone|SurvivalHUD
Standalone|VehicleSpawne
QBCore/ESX|UsableItems
QBCore/ESX|VehicleCrafting
QBCore/ESX|Recycler
QBCore/ESX|Gather
QBCore|RobberyCreator
Standalone|SafeZone
QBCore/ESX|LootAreas
QBCore/ESX|LootPeds
QBCore/ESX|RadiationZones
Standalone|ZombieSystem
QBCore|Shop
QBCore|WeatherSync
QBCore|PhoneStoreRobbery
QBCore/ESX|InGameMusic
QBCore|CamperHousing
standalone|SurvivalHUD
QBCore/ESX|LootBags
Support:
you can join my discord for any support ! Sinor System
| Code is accessible | only config |
| Subscription-based | No |
| Lines (approximately) | 350+ |
| Requirements | ESX |
| Support | Yes |
| ------------------------------------- | ---------------------------- |
