~/docs/coins-shop/configuration/delivery
coins shop docs›
Coins Shop
Delivery
-- 5 code blocks · 2 min read
The delivery system is what gives the player their vehicle, weapon, skin, money or pack once a checkout is completed. It supports three layered customization mechanisms, from simplest to most flexible.
Mechanism 1 — Weapon delivery mode
In shared/config.lua:
Delivery = {
WeaponDeliveryMode = "native", -- "native" or "item"
}
| Mode | Behavior |
|---|---|
"native" |
Uses xPlayer.addWeapon (ESX) or the QBCore native — the player gets the weapon directly. |
"item" |
Gives the weapon as an inventory item (ox_inventory, qs-inventory, qb-inventory…). The IDs in Products.Weapons must match item names that exist in your inventory. |
Mechanism 2 — Server hooks (recommended)
Hooks are the cleanest way to plug your own garage / inventory / money system without touching encrypted files. Edit server/framework/hooks.lua:
VarShop = VarShop or {}
VarShop.FrameworkOverrides = VarShop.FrameworkOverrides or {}
-- Vehicle delivery to your own garage table
function VarShop.FrameworkOverrides.giveVehicle(src, identifier, item)
-- item = { id = "rebla", kind = "vehicle", qty = 1, meta = { upgrades = {...}, plate = "..." } }
local plate = item.meta and item.meta.plate or ("VAR" .. math.random(10000, 99999))
MySQL.insert.await([[
INSERT INTO my_garage_table (citizenid, model, plate, garage)
VALUES (?, ?, ?, ?)
]], { identifier, item.id, plate, "pillboxgarage" })
return true -- true = handled, do not run default ESX/QB logic
end
-- Force a specific inventory for weapons
function VarShop.FrameworkOverrides.giveWeapon(src, identifier, item)
exports['ox_inventory']:AddItem(src, item.id, item.qty or 1)
return true
end
-- Items / skins
function VarShop.FrameworkOverrides.giveItem(src, identifier, item)
exports['ox_inventory']:AddItem(src, item.id, item.qty or 1, item.meta)
return true
end
Return
trueto signal "I handled this delivery myself". Returnnil(or nothing) to fall back to the default ESX/QB logic.
Mechanism 3 — Handlers config
If you prefer routing specific kinds to events or exports without writing hook code:
Delivery = {
Handlers = {
vehicle = { Event = "myserver:giveVehicle" }, -- TriggerEvent(event, src, identifier, item)
weapon = { Export = "ox_inventory:AddItem" }, -- exports[res][func](src, identifier, item)
skin = { Type = "framework:item" }, -- default behavior
money = { Event = "myserver:giveMoney" },
pack = { Type = "framework:pack" }, -- recursively unpack contents
},
FallbackEvent = "var-shop:deliver:item", -- triggered when no handler matched
}
Available handler keys
| Key | Effect |
|---|---|
Type = "framework:vehicle" |
Inserts into ESX owned_vehicles or QB player_vehicles |
Type = "framework:weapon" |
Native addWeapon (mode native) or addInventoryItem (mode item) |
Type = "framework:item" |
Native addInventoryItem of your framework |
Type = "framework:money" |
Native addMoney of your framework |
Type = "framework:pack" |
Unpacks contents = { { kind = "vehicle", ref = "rebla" }, … } |
Event = "..." |
TriggerEvent(event, src, identifier, item) |
Export = "resource:func" |
exports[resource][func](src, identifier, item) |
Garage table mapping
If your server doesn't follow the standard ESX (owned_vehicles) or QB (player_vehicles) schema, remap the columns in shared/config.lua:
Vehicle = {
PlatePrefix = "VAR", -- "" for no prefix
ESXTable = "owned_vehicles",
ESXOwnerColumn = "owner",
ESXPlateColumn = "plate",
ESXDataColumn = "vehicle",
ESXStoredColumn = "stored",
QBTable = "player_vehicles",
QBOwnerColumn = "citizenid",
QBPlateColumn = "plate",
QBDataColumn = "mods",
QBStateColumn = "state"
}
Item shape received by handlers
-- Vehicle
{ id = "rebla", label = "Rebla GTS", kind = "vehicle", qty = 1,
meta = { upgrades = { "perf", "plate" }, plate = "VAR12345" } }
-- Weapon
{ id = "WEAPON_AK4K", label = "AK-4K", kind = "weapon", qty = 1 }
-- Skin
{ id = "SKIN_WEAPON_NEVA", label = "Neva Glowing", kind = "skin", qty = 1,
meta = { variant = "black", weaponFor = "WEAPON_NEVA" } }
-- Money
{ id = "money_cash", label = "Cash", kind = "money", qty = 1, amount = 5000 }
-- Pack (auto-unpacked by framework:pack)
{ id = "pack_explorer", label = "Explorer Pack", kind = "pack", qty = 1 }