data/containers.lua file that registers both the item AND its container behaviour in a single entry - no duplication across data/items.lua and setup/ scripts.
How containers work
- A container is an inventory item players can hold and stack.
- Opening it (Use action) reveals a slot grid inside the right panel.
- Each container has its own slot count and weight limit, independent of the player’s inventory.
- Optional
whitelistorblacklistcontrols which items can be placed inside. - Optional
fixedWeightmakes the container weigh the same no matter what’s inside. - Containers can carry a
rarityandtagslike any other item.
The data/containers.lua file
data/containers.lua
Fields
Item fields (same as data/items.lua)
Container behaviour fields
fixedWeight only changes what the carrier feels - the container’s weight in the player’s inventory stays constant whether it’s empty or full. The container’s internal maxWeight still limits how much can be stored inside, so a fixed-weight box can’t hold unlimited cargo.Adding a new container
The whole process is three steps:1
Add an entry to `data/containers.lua`
Use a unique lowercase key (underscores allowed, no spaces).
data/containers.lua
2
Add the image
Drop a PNG named after the entry key into
web/images/. Example: web/images/duffel_bag.png. The UI auto-resolves this - no manifest edit required.3
Restart the resource
ensure ox_inventory. The new container item is now spawnable and stashable.Spawning a container in game
Use the standard admin command:1 is the target player’s server ID. Open it with the standard inventory Use action.
Worked example - restricted medical kit
A medical-only container, locked to the EMS group:data/containers.lua
Tips
- Whitelist for themed bags (food-only, ammo-only, medical-only). Players instantly understand the bag’s purpose by what slides in.
- Blacklist for “everything except” (paper bag refuses weapons, but anything else fits).
raritydoubles as visual cue - a legendary gold-bar case reads instantly on screen.- Use the
storagetag so containers appear together when the player filters by Storage. - Container weight stacks by default - a Paper Bag (50g) holding 1kg of items weighs 1.05kg in the player’s inventory.
fixedWeightfor rigid cases - the Gun Box uses it, so it always reads 800g whether empty or holding 20kg of weapons. Great for hard cases, briefcases, and lockboxes where carried weight shouldn’t betray the contents.