Studios
Exchangehouse-3.jpg

Configuration

SoonExchangeQbox
PAGE 03 OF 06  ·  INSTALLATION → CONFIGURATION → EXAMPLESdocs.glitchstudios.dev
Browse docs

Everything is in config.lua, and the file is open in the escrow. Player-facing text is in locales/en.lua.

Desk#

Key Default What it does
Config.Desk.coords vec4(797.2584, -2988.7185, 6.0209, 87.9589) Desk position and heading.
Config.Desk.model s_m_m_dockwork_01 Ped model.
Config.Desk.blip sprite 478, colour 47, scale 0.75 Map blip, with label for its name.
Config.Desk.scenario WORLD_HUMAN_CLIPBOARD Idle animation. nil to stand still.
Config.Desk.place 'port desk' How messages name the desk. It replaces {desk} in the locale text.
Config.Desk.postal '12' Postal shown on the phone app until the player has visited the desk.
Config.DeskRange 6.0 Metres from the desk for listing, filling, taking back and collecting.

Market rules#

Key Default What it does
Config.Fee 0.05 Share of each sale taken from the seller.
Config.PriceMin 0.5 Lowest allowed price, as a share of the reference price.
Config.PriceMax 3.0 Highest allowed price, as a share of the reference price.
Config.MaxListings 10 Open listings per character.
Config.MaxOrders 10 Open buy orders per character.
Config.GuideDays 7 Days of trades that feed the price guide.
Config.BookLimit 1000 Most listings and orders sent to a desk screen.
Config.TradeKeepDays 60 Trade history older than this is deleted.
Config.OrderHours { 1, 6, 12, 24, 72, 168 } Durations offered for a buy order.
Config.OrderDefaultHours 72 Duration selected by default.
Config.OrderMaxHours 168 Hard cap, whatever the client sends.
Config.ExpiryCheck 60 Seconds between expiry sweeps.

Materials#

Config.Items maps an ox_inventory item name to its reference price per unit. The defaults:

Config.Items = {
    iron = 15, copper = 20, copper_wire = 12, aluminum = 35, plastic = 15, glass = 20,
    metalscrap = 10, rubber = 15, steel = 35, cloth = 25, electronickit = 120,
}

Use plain materials only. Items that carry metadata, such as durability, would come back as fresh stacks.

Optional integrations#

Config.Treasury = nil    -- example: 'glitch-treasury'
Config.FeeLever = nil    -- example: { state = 'glitch-gov:levers', key = 'exchange_fee' }

Config.Treasury names a resource that receives the fee through exports[name]:Collect(fee, 'exchange_fee', citizenid, item). The call only happens when the resource is started. With nil the fee is simply removed from the sale.

Config.FeeLever reads a percentage from a GlobalState table. If that table holds a number at that key it replaces Config.Fee, clamped to 0-100. With nil the exchange always uses Config.Fee.

Phone app#

Config.App = {
    identifier  = 'glitch_exchange',
    name        = 'Exchange',
    description = 'Buy and sell materials',
    developer   = 'Glitch Studios',
    defaultApp  = false,
}

With sd-phone running, the app registers itself and players install it from the App Store. Set defaultApp = true to pre-install it. The app stays locked until the character has visited the desk once. Players can buy and post buy orders from the app. Listing, taking back, selling to buyers and collecting only work at the desk.

Images and language#

Config.ImagePath sets where item images load from. With nil it uses the inventory:imagepath convar, then ox_inventory's own images.

Config.Locale picks a file in locales/ (en ships). To translate, copy locales/en.lua to locales/<code>.lua, translate it, add the file to shared_scripts before locales/loader.lua and set Config.Locale. Keys a translation leaves out fall back to English. The desk and phone screens in ui/app.js carry their own English text and are escrow-ignored so you can edit them.