DirkScripts
Docs
Store
#π Fields:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | β | Unique identifier for the store. |
type | 'buy' or 'sell' | β | Determines whether the store is for buying or selling. |
name | string | β | Store display name (e.g. "24/7 Store"). |
description | string | β | Short UI description shown at the top of the store interface. |
icon | string (FontAwesomeIcon) | β | Icon shown in the UI (FontAwesome class name). |
modelType | 'ped' | 'vehicle' | 'object' | β | Type of entity used to spawn the store. |
models | string[] | β | Array of model names (e.g. "s_m_m_storeclerk_01"). |
locations | vector4[] | β | Array of spawn locations with heading. |
paymentMethods | string[] | β | IDs referencing valid payment methods. |
categories | category[] | β | List of item categories shown in the UI. |
stock | stockItem[] | β | Inventory for the store. |
openingHours | [number, number] | β | Time range when store is available (e.g. {6, 22} for 6AMβ10PM). |
groups | string | string[] | Record<string, number> | β | Job, gang, or grade restrictions. |
licenses | string | string[] | β | Player must have these licenses to access the store. |
discordRoles | string | string[] | β | Discord roles required to open the store. |
canOpen | function(src: number) | β | Server-side function to determine if the player can open the store. |
theme | themeObject | β | Optional override for this storeβs visual theme. |
onExchange | function(src, items, totalPrice) | β | Called on attempted transaction. Return false to cancel. Return a second param as reason. |
#π‘ Example
luaBaseStores = BaseStores or {} BaseStore.gunshop = { id = "gunshop", type = "buy", name = "Ammu-Nation", description = "Everything you need to stay protected.", icon = "fa-solid fa-gun", modelType = "ped", models = { "s_m_m_ammucountry" }, locations = { vec4(17.8, -1108.6, 29.8, 160.0) }, paymentMethods = { "cash", "bank" }, categories = { { } }, stock = { { item = "pistol", price = 2500 }, { item = "pistol_ammo", price = 100 } }, openingHours = { 9, 21 }, groups = { police = 0, sheriff = 0 }, licenses = { "weapon_license" }, canOpen = function(src) return true end, onExchange = function(src, items, price) if price > 10000 then return false, "Transaction limit exceeded" end return true end }
