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 full-featured B2B marketplace: agencies can also sell items back to players, fulfillment can be staff-reviewed instead of instant, purchases can hand off a printable receipt to dnd_jobmanagement, and agency spending is now subject to both a hard balance constraint and a soft quota cap to prevent economic collapse.
v2.0.0 highlights: Agency economics
Recent updates (v2.0.0) focused on making agencies feel like real economic entities, not infinite wallets:
- Agency budgets — agencies now spend their own money. When they accept a Sell order, the payout comes out of their job account balance. They're also subject to a spending quota per cycle, so one wealthy agency can't absorb an entire server's output in one evening.
- Transaction tax — every sale or purchase can be taxed. Tax is either transferred to the government's treasury (a job account) or burned (removed from the money supply entirely), making it a true economic sink rather than inflation forever.
- Price spreads — instansi buyers and gang/non-instansi buyers now see different prices: staff can apply a discount or markup per agency when accepting a buy order, based on buyer type.
- Stash upkeep — agencies now pay a recurring cost to hold inventory, both a flat fee and a per-unit charge. Warehousing is no longer free.
See the Features Overview and Configuration for detailed breakdowns.
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.
- Agency economics — Agencies spend their own money and have spending quotas. Transactions are taxed. Holding inventory costs upkeep. The economy has real constraints now.
- Dashboard NUI — per-agency price/stock table, target editing, price holds, Discord webhook, recent transactions, budget overview, and per-agency Buy price adjustments — 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).
- The payout is drawn from the agency's job account (if budget enforcement is enabled). If the agency is out of balance, the sale is rejected.
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. - Revenue lands in the agency's job account (if banking is enabled).
Dashboard & market overview
/dedashboard— per-agency manager view: prices, targets, holds, webhook, transactions, budget status, upkeep costs./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.
- Configure
config.luato match your server (agencies, items, banking, printer integration) — see Configuration. This is where you enable budgets and taxes. - Optional: re-skin the NUI's accent colors — see Theming.
- Add
ensure dnd_economyto yourserver.cfgand start the resource. - First boot: watch the console for
ConfigSync.ValidateJobswarnings. Job names must match your framework exactly (case-sensitive, no aliases).
Production-ready settings
Config.Debug = false(config.lua)Config.Banking.Enabled = truewithRenewed-Bankingrunning — the resource stays production-safe even without it, but Buy revenue will be lost.Config.Budget.Enabled = trueto enforce agency spending limits — set tofalseonly during transition testing.Config.Tax.Enabled = trueand setConfig.Tax.destinationto a valid government job name or'burn'to remove money from the supply.- Set
Config.Printer = 'none'if you don't rundnd_jobmanagement, or'dnd_jobmanagement'to enable the purchase-document hook. - Verify job names in
Config.JobsandConfig.Agencies[].jobmatch your framework exactly — this is silent-failure territory.