# Manual Safe Events

{% hint style="info" %}
To use Manual Safe Events you have to enable Safe Events in config
{% endhint %}

{% hint style="info" %}
Server Event sent by Safe Events System has token on 33 index argument, if your resource sends more arguments than 32 then argument index 33 will be overwritten with token
{% endhint %}

### Exports for Safe Events

```lua
-- CLIENT-SIDE
exports["anticheat-name"]:ExecuteServerEvent(EventName, ...)
exports["anticheat-name"]:ExecuteLatentServerEvent(EventName, bps, ...)
-- SERVER-SIDE
exports["anticheat-name"]:RegisterSafeEvent(EventName, config, cross_scripts)
exports["anticheat-name"]:VerifyToken(source)
```

```lua
-- RegisterSafeEvent default config :
{
    log = true,
    ban = true
}
```

> ExecuteServerEvent export:
>
> Executes Safe Event

> RegisterSafeEvent export:
>
> Registers Event in Safe Events System

> VerifyToken export:
>
> Stops the event from being executed if the player got banned by Safe Events System

### Example Of Code

{% tabs %}
{% tab title="Client-Side" %}

```lua
local money = 200

exports["anticheat-name"]:ExecuteServerEvent("taxi:pay", money)
```

{% endtab %}

{% tab title="Server-Side" %}

```lua
local allEvents = {
    ["taxi:pay"] = false
}
local fiveguard_resource = ""
AddEventHandler("fg:ExportsLoaded", function(fiveguard_res, res)
    if res == "*" or res == GetCurrentResourceName() then
        fiveguard_resource = fiveguard_res
        for event,cross_scripts in pairs(allEvents) do
            local retval, errorText = exports[fiveguard_res]:RegisterSafeEvent(event, {
                ban = true,
                log = true
            }, cross_scripts)
            if not retval then
                print("[fiveguard safe-events] "..errorText)
            end
        end
    end
end)

RegisterNetEvent("taxi:pay")
AddEventHandler("taxi:pay", function(money)
    local source = source
    if not exports[fiveguard_resource]:VerifyToken(source) then return end
    print("user", source)
    print("money", money)
end)

```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fiveguard.net/safe-events/manual-safe-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
