> For the complete documentation index, see [llms.txt](https://nodemods.gitbook.io/nodemods-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nodemods.gitbook.io/nodemods-docs/event-guard/config.md).

# Configuration Guide

## Installation

1. Add Event Guard to your resources folder
2. Open your resource's `fxmanifest.lua` (or `__resource.lua` for older versions)
3. Add the following before any other scripts:

```lua
shared_scripts {
    "@Event-Guard/config.lua",
    "@Event-Guard/main.lua"
}
```

**Please note that these two are the only shared scripts needed to be added to your other resources fxmanifest.lua, do not add any other scripts from Event Guard to your resources.**

4. Start the resource before all other resources in your `server.cfg`.

## Configuration Options

### Event Registration Logging

```lua
Events_cfg.logRegisteredEventsWithoutFunctions = false
```

* Controls whether warnings are given for events registered without handler functions
* Useful for debugging event registration patterns

### Suspicious Events Processing

```lua
Events_cfg.allowSuspiciousEvents = false
```

* Controls whether events are processed when salt validation meets ban threshold
* `false`: Events exceeding ban threshold are cancelled (default)
* `true`: All events proceed regardless of salt validation
* Events not meeting ban criteria always proceed regardless of this setting

### Event Ignore List

```lua
Events_cfg.eventIgnore = {
    -- Basic FiveM Events
    "CEvent.*",
    "entityDamaged",
    -- Add custom events here
}
```

* List of events to exclude from Event Guard protection
* Supports pattern matching using Lua patterns
* Default list includes essential FiveM events

### Event Name Encryption Ignore

```lua
Events_cfg.eventNameEncryptIgnore = {
    -- "Sudo:.*",  -- Example pattern
    -- "testEvent" -- Example specific event
}
```

* Events that should skip name encryption
* Useful for compatibility with certain resources

### Salt Configuration

```lua
Events_cfg.Salt = {
    maxDifference = {
        global = {
            log = 2,  -- Triggers logging
            ban = 3   -- Triggers ban action
        },
        event = {
            log = 2,
            ban = 3
        }
    },
    eventCooldown = {
        -- ["Core:PlayerDamage"] = 5000, -- 5 second cooldown
        -- ["Core:PlayerHeal"] = -1      -- Disable salt increase
    }
}
```

* `maxDifference`: Controls tolerance for salt verification
  * `log`: Triggers warning logs (may occur due to lag)
  * `ban`: Triggers automatic ban action
* `eventCooldown`: Customizable cooldown periods for specific events
  * Values in milliseconds
  * Use -1 to disable salt increase for specific events
  * Default cooldown is 1 second for unlisted events

### Event Logger Configuration

```lua
Events_cfg.EventLogger = {
    commandName = "toggleEventLogger",
    dontLogEvents = {
        -- "lb-phone.*",
        -- Add patterns to exclude from logging
    },
    checkPermission = function()
        return false  -- Customize permission check
    end
}
```

* `commandName`: Command to toggle the event logger UI
* `dontLogEvents`: Events to exclude from logging
* `checkPermission`: Function to control access to the logger

### Heartbeat System

```lua
Events_cfg.HeartBeats = {
    heartbeatInterval = 10000,  -- 10 seconds
    maxMissedHeartbeats = 3    -- Ban threshold
}
```

* `heartbeatInterval`: Time between heartbeat checks (milliseconds)
* `maxMissedHeartbeats`: Number of missed beats before action

## Discord Webhooks

Discord webhooks are configured in the server-only configuration file (`server-config.lua`) to ensure security. Configure the following webhooks:

* Error logging
* Cheat detection logging
* Ban actions

The webhook system provides detailed information including:

* Player information (name, source, ping)
* Event details and parameters
* Reason for action
* Timestamps

## Best Practices

1. **Event Whitelisting**:
   * Carefully review the `eventIgnore` list
   * Add resource-specific events that should bypass protection
2. **Salt Configuration**:
   * Adjust `maxDifference` based on server performance
   * Configure `eventCooldown` for frequently triggered events
3. **Permission Management**:
   * Implement proper permission checks in `checkPermission`
   * Restrict event logger access to trusted staff
4. **Webhook Setup**:
   * Use separate webhooks for different types of logs
   * Keep webhook URLs secure in server-side config

## Compatibility Notes

* Works with encrypted resources (e.g., lb-phone)

## Support

For additional support or updates:

1. Visit our [Tebex Store](https://sudo-scripts.tebex.io/)
2. Join our Discord community
3. Check the FiveM forums for announcements

## Getting Help

If you're experiencing issues not covered in [Troubleshooting Guide](/nodemods-docs/event-guard/troubleshooting.md)

1. Check the [FiveM Forum Thread](/nodemods-docs/event-guard/config.md)
2. Open a support ticket through our [Discord Support Channel](https://discord.com/invite/ywgT4A7nPn)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://nodemods.gitbook.io/nodemods-docs/event-guard/config.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
