# Anti trigger event protection

{% hint style="info" %}
**Anti trigger event protection is a standalone resource that prevent players to call triggers from executors. This feature is collected from Reason Anticheat and can be used separately in case you need only this feature.**
{% endhint %}

{% hint style="info" %}
This resource uses Asset Escrow System provided by FiveM.
{% endhint %}

{% hint style="info" %}
This resource has ox\_lib dependency
{% endhint %}

{% hint style="info" %}
The event protection works on tokenizer principle, which means each protected event generates a token when a trigger server event is called from the server, and if the token does not match, the player will get banned.
{% endhint %}

### Description

{% code overflow="wrap" %}

```
Anti trigger event protection feature will prevent players to call triggers from executor. When a trigger is called for a player from scripts normally, there will not be any problem, but if the player tries to call the trigger from executor he will be detected and get him banned.
```

{% endcode %}

### Usage

{% code overflow="wrap" %}

```
Command raceventprotection [install] [resource name] will add event protection to all events registered in that resource. This feature will not allow players to call trigger events from executors. When this command is executed in server console the fxmanifest and server scripts of your resource will be affected.
```

{% endcode %}

{% hint style="warning" %}
Make sure that you started the event protection resource as first resource in server.cfg, above your resource list.
{% endhint %}

{% hint style="warning" %}
Make sure to create a backup of your resource before you use this command in order to recover it.
{% endhint %}

<figure><img src="/files/XRnckngeO7oNwMawCgix" alt=""><figcaption><p>Installation command for resource testresource</p></figcaption></figure>

<figure><img src="/files/Z3MJijx2murLvBNHR8ji" alt=""><figcaption><p>After server restart events from resource testresource have been protected</p></figcaption></figure>

{% hint style="warning" %}
In case the command for adding event protection to the resource does not work properly for you or you want to protect only some events from the resource, you can also add the event protection manually. To add event protection manually you have to replace in your server scripts from the resource the AddEventHandler with SecuredEventHandler for all events you want to protect and add in fxmanifest the following lines:

```lua
lua54 "yes"
client_script "@rac/source/client/trigger.lua"
server_script "@rac/source/server/trigger.lua"
shared_scripts {"@ox_lib/init.lua"}
dependencies {"ox_lib"}
```

{% endhint %}

### Showcase

{% embed url="<https://streamable.com/0on6gi>" %}
Anti trigger event protection
{% endembed %}

{% hint style="danger" %}
The raceventprotection command is no longer working on the latest server artifacts. In order to make it work, you must temporarily turn off your server and switch to an older artifacts version where the command is still supported, for example the Last Recommended (7290). After you switched to an older artifacts version, run the command to install event protection on all your resources where you need the event protection. After you added the event protection to your needed resources, you can revert back to the latest artifacts version. If you do not want to change your artifacts and then revert to your initial artifacts, you can do the process of adding event protection manually.
{% endhint %}


---

# 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.reasonanticheat.net/resources-documentation/anti-trigger-event-protection.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.
