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.
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.
Why this over typical shop scripts
| Typical Shop Scripts | rde_shops |
|---|---|
| Dynamic in-game shop creation | Full CRUD in-game, zero restarts |
| Shop templates (bulk item presets) | 5 templates, 70+ items in one click |
| Multi-purchase race condition | Debounced refresh, crash eliminated |
| Robbery system | NPC reactions, police alert, progressive difficulty |
| Per-player reputation | Affects item prices directly |
Quick Start
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.
Shop Templates
| Template | Items |
|---|---|
| 🔫 Ammu-Nation (Complete) | 70 — ammo, melee, pistols, SMGs, shotguns, marksman rifles, every attachment |
| 🏪 24/7 Supermarket | 13 — snacks, drinks, first aid, cigarettes, phone |
| 💊 Pharmacy | 7 — bandages, medikit, painkillers, antidote, adrenaline, defibrillator |
| ⛽ Gas Station | 8 — drinks, jerrycan, rag, basics |
| 🍺 Liquor Store | 8 — beer, wine, vodka, whiskey, rum, cocktails |
Robbery System
Aim a qualifying weapon at the NPC clerk for aimTime seconds while the shop isn't on robbery cooldown.
| Outcome | Chance |
|---|---|
| Clerk raises hands and freezes | 95% |
| Clerk pulls a weapon and fights back | 5% |
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.
Reputation & Till
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.
Configuration
Config.ShopTemplates['my_black_market'] = {
label = '💀 Black Market',
pedModel = 'g_m_y_lost_01',
items = {
{ name = 'WEAPON_ASSAULTRIFLE', price = 18000, quantity = 5 },
}
}
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.
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.
Changelog
Shop Templates, 80+ blip sprites, 29 colors, multi-purchase race-condition fix, openInventory race-condition fix.
Initial release — stable shop IDs, stock depletion, robbery callbacks, till system.