For the complete documentation index, see llms.txt. This page is also available as Markdown.

New Category

This walkthrough adds a brand‑new category from scratch. As an example we'll create a "Services" category that grants a custom perk.

Step 1 — Declare the category

Add an entry to Config.Categories in config/_config.lua. The name is the internal id used everywhere; the label is what players see.

Config.Categories = {
    {name = "tokens",   label = "Tokens"},
    {name = "vip",      label = "VIP"},
    {name = "vehicles", label = "Vehicles"},
    -- ...
    {name = "services", label = "Services"}, -- 👈 new
}

Step 2 — Write the reward handler

Create server/editable/_services.lua and register a handler for the category. The handler is what actually delivers the product to the player.

RegisterReward('services', function(payload)
    local src = payload.recipient -- always deliver to the recipient
    local product = payload.product -- the product's "value"
    local info = payload.info -- full product table + custom fields

    -- Example: grant a perk based on a custom "amount" field
    local amount = tonumber(info['amount']) or 1

    local ok = SomeExport:grantService(src, product, amount)

    return ok and true or false -- false = refund, no charge
end)

Return true on success and false (or let it error) on failure. The core pipeline handles charging, logging, notifications and stock — your handler only has to deliver.

Step 3 — Add products

  1. Open the admin panel (/admin:vip).

  2. Go to Products.

  3. Click Add product, choose Services in the Category dropdown, and fill in the fields.

  4. Add any custom data your handler expects (e.g. an amount field).

  5. Save — it's live instantly.

Step 4 — Test

Restart the resource, open the shop, and buy a Services product. Watch the server console with Config.Debug = true if anything doesn't deliver.

Checklist

Last updated