Creating stashes with ox_inventory
Add fixed stashes to ox_inventory/data/stashes.lua (name, label, slots, weight, owner, groups, coords, target). From your own resource, call exports.ox_inventory:RegisterStash(id, label, slots, maxWeight, owner, groups, coords) on the server before anyone opens it, then open it on the client with exports.ox_inventory:openInventory('stash', id). owner = true gives every player their own copy; groups restricts access; CreateTemporaryStash makes throw-away storage.
Police lockers, gang safes, house storage and evidence rooms are all stashes: inventories that live somewhere in the world instead of on a player. ox_inventory gives you a data file for fixed stashes and an export for stashes your own scripts create.

#Fixed stashes in stashes.lua
{
coords = vec3(452.3, -991.4, 30.7),
target = {
loc = vec3(451.25, -994.28, 30.69),
length = 1.2, width = 5.6, heading = 0,
minZ = 29.49, maxZ = 32.09,
label = 'Open personal locker',
},
name = 'policelocker',
label = 'Personal locker',
owner = true,
slots = 70,
weight = 70000,
groups = { police = 0 },
},#Stashes from your own resource
-- a shared gang safe
exports.ox_inventory:RegisterStash('ballas_safe', 'Ballas Safe', 50, 200000, nil, { ballas = 0 }, vec3(105.2, -1941.6, 20.8))
-- one stash per house, owned by the house owner
local function registerHouseStash(houseId, ownerIdentifier, coords)
exports.ox_inventory:RegisterStash(('house_%s'):format(houseId), 'House storage', 40, 150000, ownerIdentifier, nil, coords)
endexports.ox_target:addSphereZone({
coords = vec3(105.2, -1941.6, 20.8),
radius = 1.0,
options = {
{
name = 'ballas_safe',
label = 'Open safe',
icon = 'fa-solid fa-vault',
groups = { ballas = 0 },
onSelect = function()
exports.ox_inventory:openInventory('stash', 'ballas_safe')
end,
},
},
})#The owner field
| owner | Result |
|---|---|
nil | Shared — everyone allowed sees the same items |
true | Personal — each player gets their own copy |
| A string (identifier) | Only that owner’s stash |
#Temporary stashes
local id = exports.ox_inventory:CreateTemporaryStash({
label = 'Supply crate',
slots = 10,
maxWeight = 50000,
items = {
{ 'bandage', 3 },
{ 'water', 2 },
},
})
exports.ox_inventory:forceOpenInventory(source, 'stash', id)Temporary stashes are not saved; use them for loot, drops from events and one-off containers.
#Access and security
- Always set
groupsorowneron anything valuable — the client can try to open any stash ID. - Set
coordsso the stash only opens near its location. - Log or limit what goes in with a
swapItemshook — see ox_inventory hooks.
Questions
How do I create a stash in ox_inventory?
data/stashes.lua, or call exports.ox_inventory:RegisterStash(...) on the server and open it on the client with openInventory('stash', id).How do I make a personal stash?
owner = true; every player then has their own copy of that stash.How do I restrict a stash to police?
groups = { police = 0 } (or a higher minimum grade).Are temporary stashes saved?
CreateTemporaryStash inventories are for short-lived containers.Ready to pick a map?
Twelve themes on three base map styles, $8 each, instant download.
Relevant to what you just read
The tool for this
Twenty theme pairs for ox_lib and ox_inventory From $15, built in the browser, exported as a drop-in resource.