Discord Store
Distribution

Installation

Install Urban Supply first. Then import two tables, add the crate items and start this resource after Urban Supply.

Steps

1
Check Urban Supply
You need dh_urbansupply v2.6 or newer, installed and working. See its installation page.
2
Copy the resource
Place the dh_distribution folder in your resources directory.
3
Run the SQL
Import INSTALL/sql.sql (or distribution.sql + distribution_tables.sql — same tables).
4
Add the items
Paste INSTALL/dh_distribution_items.lua inside the return { … } in ox_inventory/data/items.lua. It adds every crate plus the packing_table item (its use-export dh_distribution.usePackingTable is already set).
5
Add the images
Copy INSTALL/images into ox_inventory/web/images/.
6
Match your bridge settings
Open config.lua and make the framework, notify, dispatch and inventory values match your Urban Supply config.lua.
7
Set your locations
In config_distribution.lua, set the buyer coords, packing spots and vendor coords. The shipped ones are placeholders marked TODO set.
8
Turn debug off
Set D.Debug = false before going live.
9
Add to server.cfg
After Urban Supply, then do a full restart.
Before going live — D.Debug ships as true. While it's on, any player can use /distrosetrank to jump to any rank and /distrotest to credit rank value. Turn it off on a live server.

SQL

INSTALL/sql.sql
CREATE TABLE IF NOT EXISTS `dh_distribution` (
    `identifier`   VARCHAR(64) NOT NULL,
    `value_total`  BIGINT      NOT NULL DEFAULT 0,
    `value_today`  BIGINT      NOT NULL DEFAULT 0,
    `day_stamp`    DATE        NULL,
    `crates_total` INT         NOT NULL DEFAULT 0,
    `rank`         INT         NOT NULL DEFAULT 1,
    PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `dh_distribution_tables` (
    `id`               INT          NOT NULL AUTO_INCREMENT,
    `owner_identifier` VARCHAR(64)  NOT NULL,
    `x`                DOUBLE       NOT NULL,
    `y`                DOUBLE       NOT NULL,
    `z`                DOUBLE       NOT NULL,
    `heading`          FLOAT        NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

server.cfg

server.cfg
ensure oxmysql
ensure ox_lib
ensure ox_inventory
ensure ox_target

ensure dh_urbansupply
ensure dh_distribution

Debug commands

Only work while D.Debug = true:

CommandDescription
/distrotest <crateKey> [buyerId]Simulate a full payout and rank credit for a crate
/distrosetrank <1-10>Jump to a rank and reset today's cap

Troubleshooting

Panels don't show / payouts are $0 — Urban Supply isn't running or started after this resource. Start dh_urbansupply first.
Can't pack a crate — Your rank's max tier is lower than the crate's tier, or you're missing some of its contents.
Buyer won't talk to you — Each buyer has a minimum rank (minRank).
Packing table vendor missing — Crafting.Portable.Vendor.enabled must be true, and the vendor only sells from minRank (default 7).