~/docs/coins-shop/configuration/server-event
coins shop docs›
Coins Shop
Server Event
-- 4 code blocks · 1 min read
Events you can listen to from your own resources. They are fired during the script's normal lifecycle (delivery, subscriptions, etc.).
Delivery events
| Event | Arguments | Trigger |
|---|---|---|
var-shop:deliver |
(src, identifier, items) |
Fires on every delivery (framework-agnostic) |
var-shop:deliver:esx |
(src, identifier, items, xPlayer) |
Fires when ESX is detected |
var-shop:deliver:qbcore |
(src, identifier, items, qbPlayer) |
Fires when QBCore is detected |
items is an array of:
{
{ id = "rebla", label = "Rebla GTS", kind = "vehicle", qty = 1, meta = { upgrades = { "perf" } } },
{ id = "WEAPON_AK4K", label = "AK-4K", kind = "weapon", qty = 1 },
}
Subscription events
| Event | Arguments | Trigger |
|---|---|---|
var-shop:subscription:activated |
(source, identifier, plan, state, item) |
A subscription was just activated |
var-shop:subscription:expired |
(identifier, state) |
A subscription expired |
var-shop:subscriptions:updated |
(plans) |
Plans list updated at runtime |
Example : grant priority queue on VIP subscription
AddEventHandler("var-shop:subscription:activated", function(source, identifier, plan, state, item)
if plan.id == "sub_vip" then
exports['my-priority']:grantPriority(identifier, plan.durationDays)
end
end)
Example : log every delivery
AddEventHandler("var-shop:deliver", function(src, identifier, items)
print(("[shop-log] %s received %d item(s)"):format(identifier, #items))
end)
Custom delivery routing
If you want to route a specific item kind to your own event, configure it in shared/config.lua:
Delivery = {
Handlers = {
vehicle = { Event = "myserver:giveVehicle" },
},
FallbackEvent = "var-shop:deliver:item",
}
Your event handler receives (src, identifier, item).
See Delivery customization for the full picture.