Shops
Core Inventory includes a built-in shop system configured in config_shops.lua. Shops are NPC-less inventory-based stores where players browse and purchase items from a grid layout.
Shop Configuration
Each shop is defined with a label, inventory type, items, prices, stock, and world locations:
lua
Config.Shops = {
['247'] = {
label = '24/7 Supermarket',
image = 'img/shops/247.png', -- Optional header image
inventoryType = 'smallshop', -- Inventory type from Config.Inventories
distance = 5.0, -- Interaction distance
blip = {
id = 52, -- Blip sprite ID
color = 2, -- Blip color
scale = 0.7 -- Blip scale
},
items = {
['sandwich'] = { price = 10, stock = 30 },
['water_bottle'] = { price = 3, stock = 50 },
['phone'] = { price = 500, stock = 10 },
['bandage'] = { price = 15, stock = 20 },
},
locations = {
vector3(25.74, -1347.26, 29.5),
vector3(-3038.71, 585.91, 7.91),
-- ... more locations
}
},
}Shop Properties
| Property | Type | Description |
|---|---|---|
label | string | Display name shown in UI |
image | string/nil | Header image path (relative to html/) |
inventoryType | string | Inventory layout — smallshop or bigshop |
distance | number | Max distance to interact with the shop |
blip | table | Map blip configuration (id, color, scale) |
items | table | Items available with price and stock |
locations | table | World coordinates where this shop appears |
Shop Item Properties
lua
['item_name'] = { price = 100, stock = 20 },| Property | Type | Description |
|---|---|---|
price | number | Purchase price |
stock | number | Available stock (restocks on server restart) |
Default Shops
24/7 Supermarket
Food, drinks, phones, backpacks, basic medical supplies.
Liquor Store
Beer, vodka, whiskey, wine.
Hardware Store
Tools, repair kits, lockpicks, jerry cans.
Ammunation
Weapons, ammo, attachments, magazines, scopes, suppressors.
Shop Inventory Types
Shops use special inventory types with the isShop flag:
lua
["smallshop"] = {
slots = 70,
rows = 7,
x = "60%",
y = "25%",
label = "SHOP",
isShop = true,
locked = true
},
["bigshop"] = {
slots = 240,
rows = 8,
x = "60%",
y = "25%",
label = "SHOP",
isShop = true,
locked = true
},INFO
Shop inventories are one-way — players can only purchase from them, not place items into them.
Opening Shops via Export
client
exports['core_inventory']:openShop(shopId)Opens a shop UI for the player without needing to be at a shop location. The shop must be defined in Config.Shops.
| Parameter | Type | Description |
|---|---|---|
shopId | string | Shop key from Config.Shops |
Returns:
voidExample
lua
-- Open the 24/7 supermarket
exports['core_inventory']:openShop('247')
-- Open ammunation
exports['core_inventory']:openShop('ammunation')
-- Open from a target/interaction zone
exports['ox_target']:addBoxZone({
coords = vector3(25.74, -1347.26, 29.5),
size = vec3(2, 2, 2),
options = {
{
label = 'Open Shop',
onSelect = function()
exports['core_inventory']:openShop('247')
end
}
}
})Adding Custom Shops
- Add a new entry to
Config.Shopsinconfig_shops.lua - Choose an inventory type (
smallshoporbigshop) or create a custom one - Define items with prices and stock
- Add world locations and optional blip config
lua
['customshop'] = {
label = 'My Custom Shop',
image = nil,
inventoryType = 'smallshop',
distance = 5.0,
blip = {
id = 59,
color = 3,
scale = 0.7
},
items = {
['bread'] = { price = 5, stock = 50 },
['water'] = { price = 3, stock = 50 },
},
locations = {
vector3(100.0, 200.0, 30.0),
}
},TIP
Shop images should be placed in html/img/shops/ and referenced as 'img/shops/yourimage.png'.
