Stashes & Shops
Stashes & Shops
Stashes
A stash is a fixed container in the world with its own capacity and, optionally, a job gate.
-- ox's argument order: id, label, slots, maxWeight, owner, groups, coords
exports.aty_inventory:RegisterStash('gang_safe', 'Gang Safe', 50, 100000,
nil, { 'ballas' }, vec3(441.7, -998.1, 30.7))
groups is a list of job or gang names; a truthy owner gives every character their own copy behind the same id. In config.lua the same stash is a Config.Stashes entry with id, label, slots, maxWeight, owned, groups and coords.
Registered stashes get a marker automatically, and a target zone when Config.Target.enabled is on (off by default, as in ox). Register from any resource, at any time — the world point refreshes without a restart.
Manage them live from the admin panel's Stashes tab. From the console, invplace lists every shop and stash and invplace del stash <id> removes one made from the panel.
Shops
A shop is a container that sells rather than stores.
Config.Shops = {
{
id = 'store247',
label = '24/7 Market',
currency = 'cash',
blip = { sprite = 59, color = 69, scale = 0.8 },
locations = {
vector3(25.7, -1347.3, 29.49),
vector3(-3038.71, 585.9, 7.9),
},
items = {
{ name = 'water', price = 12 }, -- no stock: unlimited
{ name = 'phone', price = 750, stock = 10 },
},
},
}
Config.Shops is a list. One definition feeds every branch in locations.
Per-line stock, per branch. Each line has its own count at each location, as in ox_inventory — buy the last phone at one 24/7 and that tile empties there while the other branches and the rest of the shop carry on. Stock comes back on restart. Config.Shops_Restock.every (0 by default, as ox has no restock) refills a share of the gap on a timer instead.
Line metadata. A line's metadata is copied onto the item bought, as ox's shops do.
Job shops. A shop with groups shows its point and blip only to those jobs, and the till refuses anyone else. The shipped Medicine Cabinet is ambulance-only and the Police Armoury police and sheriff, as ox ships them.
Licence gates. A line can require a licence; without it the tile is visible but refuses. See Licences.
A cart, not one-at-a-time. Items go into a basket and check out together, as one transaction.
Dynamic pricing
Config.Pricing = { enabled = true }
When on, prices move with what the ledger has actually measured — items that flood the server get cheaper, scarce ones get dearer. It is off by default because it changes the economy's feel, not just its numbers.
invpricing [item] show the current computed prices
invpricingrun recompute now
Commands
invplace list every shop and stash
invplace del <shop|stash> <id> remove one made from the panel
invstashreg / invshopreg self-tests of stash and shop registration
invrestock self-test of the restock refill, on a test shop
invclerks / invclerktest shop clerk peds