Studios
Storeshouse-3.jpg

Commands & Exports

SoonStoresQbox
PAGE 06 OF 07  ·  TROUBLESHOOTING → COMMANDS & EXPORTS → OX_INVENTORY PATCHdocs.glitchstudios.dev
Browse docs

Commands#

The resource has no commands. The clerk ox_target option is named glitch_shop_clerk.

Client exports#

Export signature What it does
OpenShop(shopType, shopId?) Opens an ox_inventory shop type in the store screen and returns true when it opened. Falls back to ox_inventory's window for shop types not in Config.Shops.
Takes(shopType) true when Config.Shops lists the shop type. Used by the patch.

Server exports#

Export signature What it does
OpenBusiness(src, def) Opens a store paid from a business account. def: label, icon, coords, account, balance, items = { { name, price, label?, description?, image? } }, handler = { resource, export }. Your export is called as (src, lines) and returns { bought, spent, error, balance }.
OpenCustom(src, def) Opens a store your resource runs. def: label, icon, coords, items = { { name, price, count?, was?, tag? } }, hideSoldOut, discountLabel, handler. Your export is called as (src, lines, payment) and returns { bought, spent, error, items }.
SetCardTags(src, shopType, tags?, limits?) Card tags and limit badges for one player and one shop type. shopType = nil clears them. Cleared when the player drops.
Open(src, shopType, shopId?) Opens the screen after ox_inventory ran its own checks. Called by the patch, at most twice a second per player.
Takes(shopType) true when Config.Shops lists the shop type.

ox_inventory exports added by the patch#

Export signature What it does
SetShopPriceMultiplier(shopType, items, mult?) Multiplies the prices of the named items in every shop of a type, open ones included. nil or 1 restores the normal price.
GlitchOpenShop(source, shopType, shopId) The openShop checks: groups, distance and hooks.
GlitchGetShop(source, shopType, shopId) The stock of one shop, with locked = 'licence' or 'grade' on items this player may not buy.
GlitchBuyItem(source, shopType, shopId, fromSlot, count, payment?) Buys from a shop slot into the player's inventory through ox_inventory's buyItem. payment = 'bank' pays a money price by card.

Hooks, events and state#

Name Kind Notes
ox_inventory buyItem and openShop hooks Hooks Every purchase and open from this screen runs them, so robbery, tax and ledger scripts keep working.
glitch-stores:tags Player state bag Older way to set card tags: { shop, tags, limits }, set from the server with replicated = false. Use SetCardTags in new code.
glitch-stores:server:open, glitch-stores:server:buy lib.callback Used by the store screen. Not an integration API.
glitch-stores:client:open, glitch-stores:server:close Net events Used by the store screen. Not an integration API.
glitch-poolcleaning:netcount Server event Sent at most once a second while Config.NetGuard is on and glitch-poolcleaning is started.