βοΈConcepts & How It Works
This guide shows how to create and reuse shop themes in MarketV2. Define visuals (NPC/blip/marker/UI), payments, access rules, and full item catalogs, then style the UI via CSS theme tokens
π RISK MARKET V2 β SHOPS & THEMES
Note: This script receives regular updates with new features and improvements. This documentation may not reflect the latest version. Always refer to the most recent configuration files, example configs, and release notes included with your script version for accurate and up-to-date information.
1) Overview
Shops are world instances you place (in
Config.MarketShops,WeaponShops,BlackMarkets,JobShops).Each shop points to a theme:
Config.MarketThemes[THEME_KEY].A theme defines visuals (NPC/blip/marker/UI colors), economy (payments), access, and the catalog (categories + items).
2) Theme Anatomy
Define under Config.MarketThemes:
Config.MarketThemes = Config.MarketThemes or {}
Config.MarketThemes.mytheme = {
distance = 3.0,
npc = { enabled = true, model = 'a_m_y_business_01' },
blip = { enabled = true, sprite = 52, color = 48, scale = 0.8, name = 'My Themed Shop' },
marker= { enabled = true, type = 29, scale = 0.5, color = { r=255,g=255,b=0,a=150 } },
ui = {
title = 'MY THEME',
description = 'Welcome!',
showStock = true -- show stock to customers on owned shops
},
payment = {
cash = true,
bank = true,
blackmoney = false
-- itemCurrency = { enabled = true, item = 'gold_token', per = 100 }
},
-- Optional access control (jobs/grades):
access = {
jobs = 'all', -- or { 'police','ambulance' }
minGrade = 0,
minGrades = { police = 3 }
},
weaponsAsItems = false, -- false=give to loadout, true=inventory item
-- Optional per-job category gates:
-- categoryAccess = {
-- police = { { minGrade = 2, categories = { 'Restricted' } } }
-- },
categories = {
{ name = 'Snacks', icon = 'img/items/hamburger.png' },
-- { name = 'Restricted', icon = 'img/categories/crown.png' }
},
items = {
Snacks = {
{ name='bread', label='Bread', price={min=10,max=15}, image='img/items/bread.png', description='Fresh loaf.' },
{ name='hamburger', label='Hamburger', price={min=25,max=25}, image='img/items/hamburger.png', description='Juicy & quick.' }
}
-- Restricted = { ... }
}
}Rules
Category names in
itemsmust matchcategories.pricecan be a number (price=100) or{min,max}.imagecan beimg/...(NUI) orhttps://....
3) Attach Theme to a Shop
IDs must be unique across all shops.
Switch look/catalog by changing
theme.NEW: Each shop can have its own license requirements via the
licensetable.
4) License System (NEW)
Per-Shop License Configuration
Each shop can require a license. Configure in the shop's coords:
License Modes
'item'
Player must have item in inventory
itemName = 'weapon_license'
'esx'
ESX license system check
esxType = 'weapon'
'tkmdt'
TK-MDT license system
tkmdtType = 'weapon' / 'pistol' / 'rifle'
Example: Weapon Shop with License
Example: TK-MDT Pistol Shop
TK-MDT Configuration
Enable/disable TK-MDT weapon registration globally:
License Notifications
When a player lacks a license, they receive a notification:
β You need a valid license
5) UI Styling (CSS)
Frontend adds theme-<key> on <body>. Define colors in html/css/config.css:
6) Payments
Toggle cash, bank, blackmoney in payment.
Item Currency
QBCore Black Money as Item
7) Ownership, Pricing & Stock
Unowned Shops
Prices read from theme each open (
min..maxrandom if range).No DB stock tracking.
Owned Shops
Prices freeze to DB on purchase (owner can edit).
Stock tracked per item (show in UI if
ui.showStock=true).Sales credit shop balance; purchases decrement stock.
8) Access Control & Weapons
Restrict by job/grade via access (and optionally categoryAccess).
Job/Grade Access (Theme Level)
Weapons
weaponsAsItems=falseβ given to loadout (duplicates blocked).weaponsAsItems=trueβ added as inventory items.
9) Delivery Missions (Owner Restock)
Start from owner UI β server calls:
Flow
Truck spawns at
Config.Delivery.Spawns[shopId].spawn.Load at
loadMarker(progress bar).Return to shop and unload β stock increases.
Configuration
10) Owner Flow (Bank & Procurement)
Buy: Charge bank; create
risk_mv2_balancesrow; freeze prices; init stock rows.Fund/Withdraw: Bank β shop balance (fee via
Config.FundFeePercent).Set Price: DB update + live NUI refresh.
Procure: Buy stock from balance at wholesale =
min(price) * (1 - Discount%).
11) Exports & Events
Server Exports
Core Events
risk_markets:openβ Open UI for shop id (server).risk_markets:purchaseβ Process cart/payment (server).
Owner Actions
risk-mv2a:setItemPricerisk-mv2a:fundAccountrisk-mv2a:withdrawAccountrisk-mv2a:procureItem
Delivery Flow
risk-markets:delivery:*(spawn/load/unload/done)
12) Images & Paths
Prefer local
img/...under the resource'shtmlfolder.Remote images: full
https://....If you rename the resource, update any
nui://<resource>/...paths used elsewhere.
13) ox_target vs. Markers
If
Config.UseOxTarget = trueandox_targetis running β NPC/box-zone context options.Otherwise β 3D marker + "E" prompt.
14) Best Practices
β
Keep catalog & visuals in themes; reuse themes across many shops.
β
Ensure unique shop IDs.
β
Show stock to players only where meaningful (ui.showStock=true).
β
Start access simple (jobs='all'), add minGrade/categoryAccess later.
β
Use per-shop license config for flexible access control.
β
Test license modes thoroughly before production.
15) Gotchas & Troubleshooting
β Duplicate IDs: Don't reuse (e.g., 247_2 twice) β rename one (e.g., 247_4).
β UI won't open: Check ox_target state or stand in marker and press E.
β Images missing: Bad path; verify relative to html or use https://.
β Prices not persistent: Only persist after ownership (unowned uses theme config).
β Stock not changing: Tracked only for owned shops.
β License not working: Verify license.required = true and correct mode settings.
β No license notification: Check server console for errors in license checks.
16) Minimal Example Theme + Shop
Theme
CSS
Shop
17) Weapon Shop License Examples
Example 1: Basic Weapon Shop (Item License)
Example 2: Pistol Shop (TK-MDT)
Example 3: Rifle Shop (ESX)
Example 4: No License Shop
Last updated