Commands#
Shops Creator keeps its commands to a minimum: shops are built in the creator, and players reach every shop by walking up to it. The commands below are all there is.
Command | Where | Description |
|---|---|---|
| In game | Opens the shop creator. Admins and the jobs in |
| In game, debug only | Gives you ten random stacks of the items a sell shop buys, so you can test selling without collecting them. Only registered while |
There is no player command to open a shop or its boss menu: both are opened at the shop itself, with E or your target. The boss menu point is placed by the creator on the shop's Ownership panel.
Server Exports#
For moving a shop's stock from another resource — a delivery job that restocks the 24/7, a heist that empties the Ammu-Nation, a farming script that fills a market. Every export works on both kinds of shop: on a store it changes the item's stock, on a sell shop it changes how many more units the shop will buy (its max quantity).
shopId is the shop's id from the qs_shops table — the 29 ready-made shops are 1 to 29. Pass it as a number (1), not a string ('1'). A stock of -1 means unlimited.
AddItemStock
Adds units to an item. On an unlimited item it does nothing and still succeeds.
local ok, err = exports['qs-shops-creator']:AddItemStock(shopId, 'water', 10)
if not ok then
print('Restock failed:', err)
endamount must be a whole number above zero. Every player sees the new stock at once, and it is saved to the database.
RemoveItemStock
Takes units away from an item. The stock never drops below zero — removing more than there is leaves it at 0.
local ok, err = exports['qs-shops-creator']:RemoveItemStock(shopId, 'water', 5)An unlimited item cannot be reduced and returns false, 'unlimited_quantity'.
SetItemStock
Overwrites an item's stock with an exact value. Pass -1 to make it unlimited, or 0 to sell it out.
local ok, err = exports['qs-shops-creator']:SetItemStock(shopId, 'water', 100)
exports['qs-shops-creator']:SetItemStock(shopId, 'bread', -1) -- unlimitedGetItemStock
Reads an item's current stock: a number, -1 for unlimited, or nil when the shop or the item does not exist.
local qty = exports['qs-shops-creator']:GetItemStock(shopId, 'water')
if qty == nil then
print('That shop does not sell water')
elseif qty == -1 or qty > 0 then
print('In stock')
endWhat the errors mean#
AddItemStock, RemoveItemStock and SetItemStock return true on success, or false and one of these keys:
Key | Means |
|---|---|
| No shop has that id. |
| The item name is empty or not a string. |
| The shop does not list that item. Add it in the creator first — exports change stock, they do not add products. |
| The shop has no item list at all yet. |
|
|
|
|
|
|
| The stock saved for that item is corrupt. Re-save the item in the creator. |
A Complete Example#
A delivery job that restocks a shop when the driver drops off the crate, and refuses when the shop is already full:
-- server.lua of your delivery resource
local SHOP_ID = 1 -- 24/7 Supermarket
local MAX_STOCK = 200
RegisterNetEvent('delivery:dropOff', function(item, amount)
local src = source
local current = exports['qs-shops-creator']:GetItemStock(SHOP_ID, item)
if current == nil then
return print(('Shop %s does not sell %s'):format(SHOP_ID, item))
end
if current == -1 or current >= MAX_STOCK then
return TriggerClientEvent('ox_lib:notify', src, { type = 'error', description = 'The shop is full' })
end
local toAdd = math.min(amount, MAX_STOCK - current)
local ok, err = exports['qs-shops-creator']:AddItemStock(SHOP_ID, item, toAdd)
if ok then
TriggerClientEvent('ox_lib:notify', src, { type = 'success', description = ('Delivered %s x%d'):format(item, toAdd) })
else
print('AddItemStock failed:', err)
end
end)Customisable Functions#
Instead of exports, the client-side hooks a server owner usually wants to change are plain functions in custom/client.lua, outside the encrypted code:
Function | What to put in it |
|---|---|
| Your notification resource. |
| Your text UI, if you use neither |
| Your progress bar. Must return |
| Hide and show your HUD while a shop or menu is open. |
On the server, Notification(source, msg, type) in custom/server.lua sends every message to the client function above.



