Creating & Using Containers
Containers are shared, slot-based inventories that can be created dynamically or pre-defined for vehicles, world drops, fridges, etc. They support the same clean method API as player inventories.
Creating a Container
Use the create_container export from the server to create any container:
local data, err = exports.list_inventory:create_container("world", "fridge", {
owner = "house_7",
coords = vector3(123.4, 456.7, 789.0),
persist = true
})Params
category
string
Logical group (world, vehicle, etc.)
subtype
string
Container type (fridge, drop, etc.)
options
table
Metadata: owner, coords, persist, etc.
Getting a Container
Use get_container(id) to retrieve an active container object:
local container = exports.list_inventory:get_container("trunk:ABC123")
if not container then return endOnce retrieved, you can use any container method:
Container Methods
All container objects support these public methods:
add_item(id, amount, metadata)remove_item(lookup, amount)split_item(slot, amount)get_items()/get_item(lookup)has_item(lookup, amount)clear_items()save()/sync()get_data(key)/set_data(key, value)
Default Container Types
Container types and defaults are defined in data/containers.lua. You can modify these or add your own.
Vehicles
trunk
100
vehicle
glovebox
10
vehicle
trailer
120
vehicle
Loot & Drops
drop
200
loot
Bag prop, outlines red
airdrop
50
loot
Crate prop, outlines blue
Storage Containers
desk_fridge
5
storage
quality_preservation = 1.5
mini_fridge
40
storage
quality_preservation = 2.0
fridge
40
storage
prevent_spoil = true
You can define props, outline styles, and special logic like spoilage blocking or preservation multipliers.
Temporary Drops
Drop containers (category loot, subtype drop) are temporary. When emptied, they are:
Deleted from server memory
Removed from the client UI
These are handled internally when a player drops an item however you could make one if you want too, why not? Who said you cant.
Notes
Containers use slot limits, not weights
Some types (like fridges) can prevent degradation or slow it if enabled
If a persistent container already exists for an
owner, it will be loaded instead of recreatedYou can define your own container types freely, provided ones are purely example
Stay slotted, stay chill.™
Last updated