RDE_SHOPS DOCS
RED DRAGON ELITE // ECONOMY & GAMEPLAY

Bulk-Create a Shop
in One Click. Rob It in Ten Seconds.

rde_shops is a fully dynamic in-world shop framework for ox_core. Admins create, edit, and delete shops entirely in-game — pick a template (Ammu-Nation, Pharmacy, Liquor Store) and 70+ items bulk-insert instantly. Every shop has an NPC clerk, a till, a reputation-based pricing curve, and a scripted robbery system with realistic clerk reactions.

01 / Start Here

Overview

No config restarts, no hardcoded locations. Every shop gets its own ox_inventory stash, a spawned NPC clerk, a map blip, till money, passive income, auto-restock, and analytics.

Core Principle RegisterShop is never called from inside the buyItem hook — ox_inventory manages live stock internally once registered at startup. This single architectural decision eliminated the resource's worst crash.

Why this over typical shop scripts

Typical Shop Scriptsrde_shops
Dynamic in-game shop creationFull CRUD in-game, zero restarts
Shop templates (bulk item presets)5 templates, 70+ items in one click
Multi-purchase race conditionDebounced refresh, crash eliminated
Robbery systemNPC reactions, police alert, progressive difficulty
Per-player reputationAffects item prices directly
02 / Start Here

Quick Start

server.cfg
ensure oxmysql
ensure ox_core
ensure ox_lib
ensure ox_inventory
ensure ox_target
ensure rde_shops

Tables auto-create on first start. In-game: /createshop → pick a template (or none) → fill in name/ped/blip → done.

03 / Reference

Shop Templates

TemplateItems
🔫 Ammu-Nation (Complete)70 — ammo, melee, pistols, SMGs, shotguns, marksman rifles, every attachment
🏪 24/7 Supermarket13 — snacks, drinks, first aid, cigarettes, phone
💊 Pharmacy7 — bandages, medikit, painkillers, antidote, adrenaline, defibrillator
⛽ Gas Station8 — drinks, jerrycan, rag, basics
🍺 Liquor Store8 — beer, wine, vodka, whiskey, rum, cocktails
Note Templates are item-presets only — they don't spawn shops at fixed locations. You still place the shop wherever you want with /createshop.
04 / Reference

Robbery System

Aim a qualifying weapon at the NPC clerk for aimTime seconds while the shop isn't on robbery cooldown.

OutcomeChance
Clerk raises hands and freezes95%
Clerk pulls a weapon and fights back5%

Payout scales with the till balance. Police get a dispatch alert with wanted level, and difficulty scales progressively — more cops nearby means longer aim time and higher fight-back chance.

05 / Reference

Reputation & Till

config.lua — Reputation
Config.Shops.reputation = {
    maxRep = 100, minRep = -50,
    repGainPerPurchase = 1, repLossPerRobbery = 10,
    priceMultiplierMax = 0.9,  -- 10% discount at max rep
    priceMultiplierMin = 1.5,  -- 50% markup at min rep
}

15% of every purchase flows into the till (moneyAccumulationRate), plus configurable passive income simulating NPC customers even when nobody's buying.

06 / Reference

Configuration

config.lua — Adding a custom template
Config.ShopTemplates['my_black_market'] = {
    label    = '💀 Black Market',
    pedModel = 'g_m_y_lost_01',
    items = {
        { name = 'WEAPON_ASSAULTRIFLE', price = 18000, quantity = 5 },
    }
}
07 / More

Common Pitfalls

nil field 'items' crash on multi-purchase

RegisterShop was called inside the buyItem hook, which sets the shop internally to nil during rebuild. Any concurrent purchase hit nil and crashed, closing the UI.

Fix (v2.0.0): RegisterShop is no longer called in buyItem at all. A debounced refresh (100ms) handles admin-triggered changes only — never purchases.

"You can not open this inventory"

openShopInventory called the debounced refreshOxShop (async, 100ms delay) and immediately fired the client open event — the client arrived before registration completed.

Fix (v2.0.0): openShopInventory now performs a synchronous RegisterShop call inline before triggering the client event.

08 / More

FAQ

Can I add my own blip icons?

Yes — 80+ sprites and 29 colors ship out of the box in Config.BlipSprites/BlipColors, grouped by category.

Does reputation carry across all shops?

No — reputation is tracked per-shop per-player, so a criminal record at one store doesn't affect prices at another.

09 / More

Changelog

v2.0.0

Shop Templates, 80+ blip sprites, 29 colors, multi-purchase race-condition fix, openInventory race-condition fix.

v1.0.0-a

Initial release — stable shop IDs, stock depletion, robbery callbacks, till system.