Discord Store
Urban Supply v2

Installation

Follow these steps in order. Don't skip the SQL — the script won't work without its tables.

Steps

1
Copy the resource
Place the dh_urbansupply folder in your server's resources directory. Don't rename it.
2
Run the SQL
Import INSTALL/SQL.sql. It creates drug_progression, drug_market and drug_reputation. Safe to re-run (IF NOT EXISTS).
3
Add the items
Paste INSTALL/dh_ox_items.lua into ox_inventory/data/items.lua. If you also keep items in an items table, run INSTALL/dh_items.sql (uses INSERT IGNORE).
4
Add the images
Copy INSTALL/Images into ox_inventory/web/images/.
5
Configure
Open config.lua and set your framework, inventory, notify, dispatch and garage. See Configuration.
6
Add to server.cfg
Start it after your framework, ox_inventory and any dispatch resource.
7
Full server restart
A full restart, not just ensure.
The resource checks its own folder name on start. If it isn't exactly dh_urbansupply, the console prints PLEASE DO NOT RENAME THE SCRIPT and selling is blocked.

SQL

INSTALL/SQL.sql
CREATE TABLE IF NOT EXISTS `drug_progression` (
  `identifier`  varchar(60)  NOT NULL,
  `xp`          int(11)      NOT NULL DEFAULT 0,
  `level`       int(11)      NOT NULL DEFAULT 1,
  `last_active` timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `drug_market` (
  `drug`        varchar(60)  NOT NULL,
  `multiplier`  decimal(5,2) NOT NULL DEFAULT 1.00,
  `updated_at`  timestamp    NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`drug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `drug_reputation` (
  `identifier` varchar(64) NOT NULL,
  `zone_name`  varchar(64) NOT NULL,
  `sales`      int(11)     NOT NULL DEFAULT 0,
  `last_sale`  timestamp   NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`identifier`, `zone_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

server.cfg

server.cfg
ensure oxmysql
ensure ox_lib

# framework (one of):
ensure es_extended
# ensure qb-core
# ensure qbx_core

ensure ox_inventory
ensure dh_mdt            # or your dispatch resource (optional)

ensure dh_urbansupply
ensure dh_distribution   # optional wholesale addon — must start after dh_urbansupply

Verifying it works

After a full restart, the server console should show:

console
[UrbanSupply] Market saved to DB

Then in game:

  1. Type /trap. Buyers should start spawning around you
  2. Wait for one to walk up and press E
  3. Type /checkmarket to open this week's prices
  4. Type /rep to see your reputation

Common issues

/trap does nothing — Set Config.CopRequired = 0 if no police are online, and check your job isn't blocked by Config.Cops / Config.Ems (with AllowPoliceToSell / AllowEmsToSell off).
Items not found / undefined warnings — Add the items to ox_inventory/data/items.lua and restart ox_inventory.
Dirty money not paying out — Config.DirtyMoneyAccount must match your dirty money item/account exactly, and the item must be stack = true.
Market resets every restart — Make sure drug_market exists and oxmysql connects without errors.
Kicked out of the trap — Walking too far from where you started ends the session. Uneven ground can also drift your position.
Vehicle level reward missing — Set Config.GarageScript to the garage you run (and GarageScriptDefaultGarage for jg_advancedgarages).