Skip to content

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

PropertyTypeDescription
labelstringDisplay name shown in UI
imagestring/nilHeader image path (relative to html/)
inventoryTypestringInventory layout — smallshop or bigshop
distancenumberMax distance to interact with the shop
bliptableMap blip configuration (id, color, scale)
itemstableItems available with price and stock
locationstableWorld coordinates where this shop appears

Shop Item Properties

lua
['item_name'] = { price = 100, stock = 20 },
PropertyTypeDescription
pricenumberPurchase price
stocknumberAvailable 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

clientexports['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.

ParameterTypeDescription
shopIdstringShop key from Config.Shops
Returns: void
Example
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

  1. Add a new entry to Config.Shops in config_shops.lua
  2. Choose an inventory type (smallshop or bigshop) or create a custom one
  3. Define items with prices and stock
  4. 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'.