Configuring shops in ox_inventory
A shop in data/shops.lua has a name, optional blip, an inventory list and either locations (with markers) or targets (for ox_target). Items take name and price, plus optional count (stock), currency (for example black_money), license, grade and metadata. Restrict a whole shop with groups. From your own resource use exports.ox_inventory:RegisterShop(type, details) and open it with openInventory('shop', { type = type, id = 1 }).
Every general store, pharmacy, hardware shop and armoury in an ox_inventory server is a shop definition. The same small set of fields covers them all — plus an export for shops your own resources create, like player-owned businesses.

#A shop definition
Hardware = {
name = 'Hardware Store',
blip = { id = 402, colour = 69, scale = 0.8 },
inventory = {
{ name = 'lockpick', price = 250 },
{ name = 'repairkit', price = 600, count = 20 },
{ name = 'WEAPON_HAMMER', price = 150 },
},
locations = {
vec3(2748.0, 3473.0, 55.67),
},
targets = {
{ loc = vec3(2747.8, 3472.9, 55.67), length = 1.0, width = 3.0, heading = 65.0, minZ = 55.0, maxZ = 56.8, distance = 3.0 },
},
},#Item fields
| Field | Meaning |
|---|---|
name | Item name from items.lua or weapons.lua |
price | Cost per item |
count | Limited stock (omit for unlimited) |
currency | Item used to pay, for example black_money |
license | Licence required to buy |
grade | Minimum job grade (with shop groups) |
metadata | Metadata given with the item, for example { registered = true } |
Weapon-specific setups (legal store, police armoury, black market) are in weapon shop setup.
#Shops at runtime
exports.ox_inventory:RegisterShop('BeanMachine', {
name = 'Bean Machine',
inventory = {
{ name = 'coffee', price = 12 },
{ name = 'donut', price = 8 },
},
locations = { vec3(-634.3, 235.2, 81.9) },
groups = nil,
})exports.ox_inventory:openInventory('shop', { type = 'BeanMachine', id = 1 })id is the index of the location in the shop’s locations/targets list.
#Logging and controlling purchases
exports.ox_inventory:registerHook('buyItem', function(payload)
print(('%s bought %sx %s for %s'):format(payload.source, payload.count, payload.itemName, payload.totalPrice))
end, { typeFilter = { Hardware = true } })Return false from the hook to cancel a purchase. More: ox_inventory hooks.
Questions
How do I add a shop to ox_inventory?
data/shops.lua with a name, inventory and locations or targets, or call exports.ox_inventory:RegisterShop from your resource.How do I make a shop accept dirty money?
currency = 'black_money' on the items.How do I limit stock?
count.How do I open a shop from a script?
exports.ox_inventory:openInventory('shop', { type = 'ShopType', id = 1 }) on the client.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.
Look it up while you work
The reference tables this guide leans on, free and without an account.
- All 966 blip sprite idsThe number SetBlipSprite takes, with the texture name beside it. Searchable, and one click copies a value.