> For the complete documentation index, see [llms.txt](https://docs.rainmad.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rainmad.com/resources/decal-v-graffiti-and-vehicle-sticker/events-and-exports.md).

# Events & Exports

## Server event hooks

Three public hooks fire on the server. Handle them in `rm_decalv/server/events.lua`; the file is open (escrow-ignored) and safe to edit.

```lua
AddEventHandler('rm_decalv:server:onDecalAdded', function(data)
    -- data.source    number  player who placed it
    -- data.type      'sticker' | 'graffiti'
    -- data.fileName  string
    -- stickers: data.plate, data.model
    -- graffiti: data.posX, data.posY, data.posZ
end)

AddEventHandler('rm_decalv:server:onDecalRemoved', function(data)
    -- same payload as onDecalAdded
end)

AddEventHandler('rm_decalv:server:onRestrictedAttempt', function(data)
    -- data.source  number  player who tried
    -- data.zone    string  cfg.restrictedZones label
    -- data.posX / posY / posZ
    -- hook this into your dispatch for "someone tagging near the PD" alerts
end)
```

{% hint style="info" %}
Handlers written for v2 keep working unchanged: every hook also fires under the legacy `rm_decalv2:server:*` names.
{% endhint %}

## Per-decal `canUse`

Any catalog entry (or whole block) can carry a server-side gate that runs as the final check on save. The decal still shows in the catalog, but locked:

```lua
{
    label = 'VIP Tag',
    fileName = 'vip_tag.webp',
    canUse = function(playerId, label, fileName)
        return exports['my_vip_script']:isVip(playerId)
    end,
},
```

## Discord logging

Decal create/clear events route through `rm_decalv/server/discord_log.lua`, an open file you can rewrite entirely. Logging is **off by default**: set `enabled = true` and your webhook URL in the file's config to turn it on, and shape the embed however you like. v2-era `discordLog = { enabled, webhook, sendLog }` table copies are still honored.

The default logger attaches the decal's image to every create/clear embed as its thumbnail, so moderators see what was sprayed without joining. Drop the `image` field from the entry in `discord_log.lua` if you'd rather keep the logs text-only.
