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:
Copy local data , err = exports . list_inventory : create_container ( " world " , " fridge " , {
owner = " house_7 " ,
coords = vector3 ( 123.4 , 456.7 , 789.0 ),
persist = true
}) Logical group (world, vehicle, etc.)
Container type (fridge, drop, etc.)
Metadata: owner, coords, persist, etc.
Getting a Container
Use get_container(id) to retrieve an active container object:
Copy local container = exports . list_inventory : get_container ( " trunk:ABC123 " )
if not container then return end Once 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)
get_items() / get_item(lookup)
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.
Type
Default Slots
Category
Type
Default Slots
Category
Extras
Crate prop, outlines blue
Storage Containers
Type
Default Slots
Category
Notes
quality_preservation = 1.5
quality_preservation = 2.0
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.
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 recreated
You can define your own container types freely, provided ones are purely example
Stay slotted, stay chill.™
Last updated 7 months ago