Config‑driven shop system for RedM using RSG Core and rsg-inventory.
Adds General Stores and Gunsmiths across the map with ox_lib prompts, map blips, and inventory‑backed shop UIs.
Products, prices, stock, and locations are all defined inconfig.lua.
- rsg-core 🤠
- ox_lib ⚙️ (for locales and prompts)
- rsg-inventory 🎒 (shop UI & persistence)
- oxmysql 🗄️ (if inventory persistence is enabled)
Locales: locales/en.json, fr.json, es.json, el.json, pt-br.json.
Keybind: Config.Keybind (default 'J') is displayed in the interaction prompt.
- Define product groups in
Config.Products(e.g.,normal,weapons,medic, etc.). - Each entry is a list of items with:
name(item name),amount(initial stock; omit for unlimited),price(buy price; addbuyPriceto allow selling to the shop),maxStock(cap for player‑sold items),minQuality(min condition for buy‑back),restock(per restock cycle).
- Add stores in
Config.StoreLocations(label, name, product group, coords). - Optional blip per store with
blipsprite,blipscale, andshowblip.
- On resource start, server registers each store with rsg‑inventory:
exports['rsg-inventory']:CreateShop({ name = shopConfig.name, label = shopConfig.label, slots = #itemTable, items = itemTable, persistentStock = shopConfig.persistentStock, })
- When prompted, server opens the shop UI:
exports['rsg-inventory']:OpenShop(source, name)
- Supports persistent stock with
persistentStock = true.
- Example: medical shops require
playerjobtype == 'medic'. - You can extend checks server‑side to gate other product groups.
- Client registers a prompt at each store:
exports['rsg-core']:createPrompt(v.name, v.shopcoords, RSGCore.Shared.Keybinds[Config.Keybind], locale('lang_1') .. v.label, { type = 'server', event = 'rsg-shops:server:openstore', args = { v.products, v.name, v.label }, })
Config.Products = {
['normal'] = {
{ name = 'bread', amount = 50, price = 0.10 },
{ name = 'water', amount = 50, price = 0.10 },
},
['weapons'] = {
{ name = 'weapon_revolver_cattleman', amount = 1, price = 50 },
{ name = 'weapon_revolver_doubleaction', amount = 1, price = 127 },
-- ...
},
}
Config.StoreLocations = {
{
label = 'Rhodes General Store',
name = 'gen-rhodes',
products = 'normal',
shopcoords = vector3(1328.99, -1293.28, 77.02 -0.8),
blipsprite = 'blip_shop_store',
blipscale = 0.2,
showblip = true,
persistentStock = false,
},
{
label = 'Annesburg Gunsmith',
name = 'wep-annesburg',
products = 'weapons',
shopcoords = vector3(2946.50, 1319.53, 44.82),
blipsprite = 'blip_shop_gunsmith',
blipscale = 0.2,
showblip = true,
persistentStock = false,
},
}- Place
rsg-shopsinside yourresources/[rsg]folder. - Ensure rsg-core, ox_lib, rsg-inventory, and oxmysql are installed.
- Configure
config.lua(products, locations, prices, persistence). - Add to your
server.cfg:ensure ox_lib ensure rsg-core ensure rsg-inventory ensure rsg-shops
- Restart your server.
Included languages: en, fr, es, el, pt-br.
Uses lib.locale() for prompts and messages.
- RSG / Rexshack-RedM and contributors
- Community testers and translators
- License: GPL‑3.0