🛜Server event

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

Custom delivery routing

If you want to route a specific item kind to your own event, configure it in shared/config.lua:

Your event handler receives (src, identifier, item).

See Delivery customization for the full picture.

Last updated