Resourcesdnd_economy
Getting Started
Last updated on
This documentation covers setup, configuration, and internals of the dnd_economy resource.
What the resource does
dnd_economy is a dynamic, supply-and-demand economy system for FiveM agencies (government, black market, or any custom job you configure). Prices move on their own — sell into an agency and its price for that item drops; buy from it and the price climbs — driven by a power-law formula against a configurable target_stock per item, per agency.
It started as a sell-only price calculator and grew into a small B2B marketplace: agencies can also sell items back to players, fulfillment can be staff-reviewed instead of instant, and a purchase can hand off a printable receipt to dnd_jobmanagement.
Highlights
- Live pricing engine — power-law price curve (
(target/current)^k), configurable floor/ceiling/sensitivity/decay per item, an hourly decay scheduler, and price snapshots for trend history. - Sell & Buy, both staff-first — a sale or purchase always tries the pending queue when staff are on duty for the agency's job; Sell falls back to NPC on timeout, Buy has no timeout and waits indefinitely (a purchase needs a document printed before it can be fulfilled).
- Multi-item Buy cart — a dedicated NUI lets a buyer add several items to one cart with a running total and a single checkout, instead of one order per item.
- Dashboard NUI — per-agency price/stock table, target editing, price holds, Discord webhook, recent transactions, and (new) a per-agency Buy price-adjustment amount — all editable live, no restart.
- Config-driven theming —
Config.Colorlets you re-skin the NUI's accent colors without touching CSS; see Theming for a live preview + config generator. - Optional integrations —
Renewed-Bankingfor Buy revenue (agency job account) anddnd_jobmanagementfor auto-queuing a printable purchase document when staff accept a Buy order.
Core workflows
Selling to an agency
- Player interacts with the agency NPC (ox_target) and picks a quantity to sell.
- If staff are on duty for that agency's job, the sale goes to the pending queue and a staff member accepts/rejects it from the Pending NUI (
/depending) or/deaccept <id>. - If nobody accepts before
Config.HumanResponseTimeout, or nobody's on duty, it falls back to an instant NPC sale. - Price recomputes immediately after any sale (stock went up → price drifts down).
Buying from an agency
- Player interacts with the same NPC's Buy option — opens a cart NUI (not the sell menu): browse items, add several with quantities, see a running total, checkout.
- Checkout always creates a pending order — no timeout, no instant fallback. If nobody's on duty, the buyer is told to wait; the order stays queued.
- Staff review it from the Pending NUI's Buy tab, pick a purchase-type ("instansi"/job vs "gang"/non-instansi — applies a configurable ± price adjustment), and accept.
- If
Config.Printer = 'dnd_jobmanagement', a printable purchase document is queued automatically into that resource's printer system at accept time.
Dashboard & market overview
/dedashboard— per-agency manager view: prices, targets, holds, webhook, transactions, Buy price adjustment./demarket— read-only, public-facing overview across all agencies (demand labels, optional stock numbers perpublicStock).
Recommended first steps
- Install dependencies — see Dependencies.
- Import the database schema — see Database Setup.
- Build the frontend (
cd web && npm install && npm run build). - Configure
config.luato match your server (agencies, items, banking, printer integration) — see Configuration. - Optional: re-skin the NUI's accent colors — see Theming.
Production-ready settings
Config.Debug = false(config.lua)- Verify
web/distwas built (cd web && npm run build) — it's git-ignored and not shipped pre-built. - Set
Config.Banking.Enabled = truewithRenewed-Bankingrunning if you want Buy enabled — it stays effectively disabled otherwise. - Set
Config.Printer = 'none'if you don't rundnd_jobmanagement, or'dnd_jobmanagement'to enable the purchase-document hook.