Commands#
The resource registers no chat commands. Players use the ped's ox_target option, Materials Exchange, or the Exchange app in sd-phone.
Exports#
The resource registers no exports of its own. It calls these:
| Export | Where | Used for |
|---|---|---|
exports[Config.Treasury]:Collect(fee, 'exchange_fee', citizenid, item) |
Server | Optional fee bookkeeping, called only when Config.Treasury is set and that resource is started. |
exports['sd-phone']:addCustomApp, removeCustomApp, sendCustomAppMessage |
Client | Registering the Exchange app and pushing live updates to it. |
Events#
| Event | Side | What it does |
|---|---|---|
glitch-exchange:watch |
Server, from client | The desk or phone app tells the server it is open (true) or closed (false). Only watchers receive live updates. Ignored without a character and throttled to one call per 300 ms. |
glitch-exchange:dirty |
Client, from server | Tells an open desk or phone app that the market changed and it should reload its state. |
These two belong to the resource's own screens. Do not trigger them from other scripts.
Callbacks#
All are lib.callback calls served by the server. Each one checks the character, the desk distance where it applies, and the limits.
| Callback | Arguments | What it does |
|---|---|---|
glitch-exchange:state |
none | Returns the market, the player's listings, orders, pickups, history and inventory counts. Repeat calls within 300 ms get the last answer. |
glitch-exchange:buy |
id, qty |
Buys from a listing. |
glitch-exchange:order |
item, qty, price, hours |
Posts a buy order, matching against listings first. |
glitch-exchange:cancelOrder |
id |
Cancels an order and returns the held money. |
glitch-exchange:list |
item, qty, price |
Lists goods from the player's inventory. |
glitch-exchange:unlist |
id |
Takes a listing back. |
glitch-exchange:fill |
id, qty |
Sells into someone's buy order. |
glitch-exchange:collect |
none | Collects purchases and unsold stock waiting in the pickup box. |
Database tables#
| Table | Holds |
|---|---|
glitch_exchange_listings |
Open listings: seller, item, quantity, price. |
glitch_exchange_orders |
Open buy orders with their expiry time. |
glitch_exchange_pickups |
Goods waiting to be collected, per character and item. |
glitch_exchange_trades |
Trade history for the price guide, pruned by Config.TradeKeepDays. |
glitch_exchange_events |
Short notes shown in a character's trade history. |
glitch_exchange_members |
Characters who have visited the desk, which unlocks the phone app. |
glitch_exchange_payouts |
Payments qbx_core refused, paid at the next desk visit. |
Stuck on a step?Ask in the Discord →