Event Guard

Cheat menus can call your scripts' server events directly, for example a job's payout event, hundreds of times in a few seconds to get money or items. Event Guard is a small file that sits in front of the server events of your resources and limits how often each player may call each event. This page also covers honeypot events and the game event checks CXA runs without any setup.

A Limit, Not a Validator

Event Guard limits how often an event is called. It cannot tell whether a single call is honest. A script that pays whatever amount the client sends can still be abused within the limit, so always check amounts, distances and conditions on the server in your own scripts.

What Event Abuse Is

Most scripts are split into two parts. The client part runs in the player's game and the server part runs on your server. When a player finishes a delivery, the client part sends a server event (a named message such as myjob:server:payout) and the server part pays the player.

A cheat menu can send the same server event without doing the job, as often as it wants. If the server part trusts every call, the cheater gets paid every time. Event Guard catches the unnatural number of calls and stops them before your script handles them.

How It Works

  1. You add lib/eventguard.lua from the cxa-anticheat folder as the first server script of a resource, by hand or with cxainject.
  2. The file wraps RegisterNetEvent, RegisterServerEvent and AddEventHandler inside that resource, so every server event the resource registers after it passes through Event Guard first.
  3. Each call is counted per player and per event. The count starts with the first call and resets after Window seconds.
  4. When a player goes over the limit, MaxCalls for normal events or StrictMaxCalls for strict events, Event Guard reports it to CXA once per window. CXA applies the punishment as EventAbuse (Server event abuse).
  5. With BlockExceeded on, every call above the limit is dropped and never reaches your script.

A few rules keep your scripts safe:

  • Events in IgnoredEvents are never limited.
  • Calls the server makes itself, with no player behind them, are never counted.
  • If cxa-anticheat is not running or the license is not active, Event Guard lets every call through, so your scripts keep working.
  • Each guarded resource reads its settings from CXA 5 seconds after CXA starts and then every 60 seconds. Changes from the panel reach every guarded resource within a minute, no resource restart needed.
  • Bypassed staff are never punished, but calls above the limit are still dropped for them when BlockExceeded is on.

Installing Event Guard

Step 1 — Run cxainject

Type this in the server console (the txAdmin Live Console works too):

Console
cxainject

What happens:

  • CXA goes through every resource on your server in alphabetical order.
  • It adds this line to the resource's fxmanifest.lua (or __resource.lua), directly below the fx_version line: server_script '@cxa-anticheat/lib/eventguard.lua'
  • It skips cxa-anticheat itself, every resource in Never inject into (Inject.IgnoreResources), resources that already have the line, resources without server-side Lua (no server_script or shared_script with a .lua file) and, when Skip escrowed resources is on, every resource with an .fxap file (escrow-protected resources).
  • It writes a summary to the Admin Discord channel.

Output:

Output
[CXA] Event Guard injected into 42 resource(s), 3 already had it, 17 skipped, 0 failed.
[CXA] Injected: my-delivery, my-shop, my-garage
[CXA] Restart the server (or the listed resources) to apply.

Your numbers and names will differ. Lists with more than 40 names end with + and the number of names not shown. If CXA could not write a file, a yellow line lists those resources:

Output
[CXA] Failed: my-locked-resource

The panel can do the same: Commands → Inject Event Guard. It is available to the owner and admins of the license.

Step 2 — Restart

The new line only loads when a resource starts, so restart the whole server, or at least the resources listed after Injected:.

Default Ignore List

Never inject into already contains monitor, sessionmanager, mapmanager, spawnmanager, hardcap, rconlog, chat, yarn, webpack, baseevents, oxmysql and screenshot-basic. Add any resource you do not want CXA to touch before you run cxainject.

Removing Event Guard

To remove the line from every resource again, type:

Console
cxauninject

Output:

Output
[CXA] Event Guard removed from 42 resource(s), 20 did not have it, 0 failed.
[CXA] Injected: my-delivery, my-shop, my-garage
[CXA] Restart the server (or the listed resources) to apply.

The second line starts with Injected: here as well; it lists the resources that were changed. Restart afterwards. The panel button is Commands → Remove Event Guard.

Both commands only work from the server console or the panel. Typed in game chat, they answer This command can only be used from the server console. You can rename them in Configuration → Staff roles & commands → Commands.

Manual Install

To protect a single resource by hand, open its fxmanifest.lua and add the Event Guard line directly below fx_version, the same place cxainject uses:

fx_version 'cerulean'
server_script '@cxa-anticheat/lib/eventguard.lua' -- CXA Event Guard, keep it above every other script
game 'gta5'

shared_script 'config.lua'
client_script 'client/main.lua'
server_script 'server/main.lua'

Then restart that resource. The line must come before the resource's own server scripts, because Event Guard can only wrap events that are registered after it has loaded.

Configuration

Open Configuration → Server detections → Event Guard in the panel. Changes apply to all guarded resources within a minute.

OptionKeyDefaultWhat it does
Enabled (switch)EnabledtrueTurns Event Guard on or off for every guarded resource
PunishmentPunishmentkickWhat happens to a player who goes over a limit
Ban durationBanDuration0Hours, 0 = permanent. Only used with ban
ScreenshotScreenshotfalseAttaches a screenshot to the Discord log
Max calls per eventMaxCalls25Calls of one event one player may make per Window
WindowWindow5 sLength of the counting window
Strict eventsStrictEventsemptyEvents that give money, items or rewards. They use the strict limit
Strict max callsStrictMaxCalls5Limit for strict events per Window
Ignored eventsIgnoredEventsemptyEvents that are never limited
Block calls over the limitBlockExceededtrueDrops calls above the limit. When off, the calls still run and only the punishment applies
Never inject intoInject.IgnoreResourcessee aboveResources cxainject never touches
Skip escrowed resourcesInject.SkipEscrowedfalseLeaves resources with an .fxap file untouched

The same settings in config.lua (the event names are examples, use your own):

Config.EventGuard = {
    Enabled = true,
    Punishment = 'kick',
    BanDuration = 0,
    MaxCalls = 25,                                   -- calls of one event per player per Window
    Window = 5,                                      -- seconds
    StrictEvents = { 'my-delivery:server:payout' },  -- example: an event that pays money
    StrictMaxCalls = 5,
    IgnoredEvents = { 'my-hud:server:syncStatus' },  -- example: an event fired very often by design
    BlockExceeded = true,                            -- drop calls above the limit
    Screenshot = false,
    Inject = {
        IgnoreResources = { 'monitor', 'sessionmanager', 'mapmanager', 'spawnmanager', 'hardcap', 'rconlog', 'chat', 'yarn', 'webpack', 'baseevents', 'oxmysql', 'screenshot-basic' },
        SkipEscrowed = false,                        -- true = leave .fxap resources untouched
    },
}

Choosing Strict Events

Strict events are the ones a cheater wants to spam: events whose server handler gives money, items, experience or any other reward. To find them, search the server files of your resources for the money and item functions of your framework, for example addMoney and addInventoryItem (ESX) or AddMoney and AddItem (QBCore), and note the server event that calls them.

Config with an AI Assistant does this for you: the prompt asks the assistant to put reward events into StrictEvents and events that fire very often by design into IgnoredEvents.

Reading an Event Guard Log

Every Event Guard detection lists the resource, the event and the number of calls, so you know exactly which event to adjust:

Output
[CXA] John (ID: 12) -> Server event abuse [kick] calls: 26 in 5s, event: my-delivery:server:payout, resource: my-delivery

If this is an honest player and the event is meant to fire this often, add it to Ignored events or raise Max calls per event.

Honeypot Events

A honeypot event is a fake server event that no script on your server uses. Some cheat menus call well-known event names from old scripts, for example to switch off a detection or to kick other players. CXA registers every name in Config.BlacklistedEvents as a server event and flags any player who triggers one as BlacklistedEvent (Blacklisted event). This works without Event Guard.

OptionKeyDefaultWhat it does
Honeypot events (switch)Config.ServerDetections.BlacklistedEvents.EnabledfalseTurns the honeypot on
PunishmentPunishmentlogWhat happens to a player who triggers a honeypot event
Honeypot events (list)Config.BlacklistedEvents7 namesThe fake event names

The default list contains antilynx8:anticheat, antilynxr4:detect, antilynxr6:detection, ynx8:anticheat, HCheat:TempDisableDetection, mellotrainer:adminTempBan and mellotrainer:adminKick. The switch is under Configuration → Server detections → Honeypot events, the list under Configuration → Lists → Blacklists → Honeypot events.

Only List Events Nobody Uses

If one of your resources really uses a listed event, every player who uses that script triggers the honeypot. Search your resources for each name before you add it.

Sound Event Abuse

Sound resources such as InteractSound have server events that play a sound for other players. Cheaters call them to play loud sounds to the whole server. Sound abuse (SoundAbuse) watches these events and punishes a player who calls them more than MaxCalls times within Window seconds, or who asks for a play radius above MaxDistance.

OptionKeyDefaultWhat it does
PunishmentPunishmentkickWhat happens to the abuser
Sound eventsEvents4 InteractSound eventsEvents that are watched
Max callsMaxCalls8Calls allowed per player per Window
WindowWindow10 sLength of the counting window
Max sound distanceMaxDistance30 mA PlayWithinDistance call with a larger radius is flagged

The default events are InteractSound_SV:PlayOnAll, InteractSound_SV:PlayWithinDistance, InteractSound_SV:PlayOnSource and InteractSound_SV:PlayOnOne. You find the settings under Configuration → Server detections → Sound abuse. This check punishes the player but does not stop the sound resource from handling the call, so also inject Event Guard into your sound resource.

Game Event Checks

Besides your scripts' events, the game itself reports some actions to the server, for example giving a weapon to another ped or starting a fire. CXA checks these on the server without Event Guard:

EventDetectionDefaultWhat it stops
giveWeaponEventGive weapon (GiveWeapon)banGiving weapons to another player, a mod menu feature
removeWeaponEvent, removeAllWeaponsEventRemove weapon (RemoveWeapon)banRemoving weapons from another player
clearPedTasksEventClear ped tasks (ClearPedTasks)kickKicking players out of vehicles or freezing them
startProjectileEventProjectiles (BlacklistedProjectile, ProjectileSpam)ban, spam kickProjectiles of blacklisted weapons and more than 25 projectiles in 5 seconds
ptFxEventParticle spam (ParticleSpam)kickMore than 30 particle effects in 5 seconds
fireEventFire spam (FireSpam)kickMore than 20 fires in 5 seconds
weaponDamageEventWeapon damage, Impossible damage, Silent aim and morevariesDamage with blacklisted weapons and impossible hits
Chat messagesChat filter (ChatFilter)banMessages with words from the chat word list
explosionEventExplosionsvariesSee Explosion Control
entityCreatingEntity blacklist and Entity spamlogSee Entity Control

Give weapon, Remove weapon and Clear ped tasks have two extra switches: Block cancels the action, and Only player targets acts only when the target is another player, so a script that gives a weapon to an NPC is not punished. All of them are in Configuration → Server detections.

Recommendations

Recommended:

  • Run cxainject once after installing CXA and again after you add new resources. Resources that already have the line are skipped.
  • Put every reward event into Strict events. These are the events cheaters target.
  • Keep Event Guard on log for the first days on a busy server, then switch to kick once you have moved the noisy events to Ignored events.
  • Run cxauninject before you remove CXA from your server, because the line points to a file inside the cxa-anticheat folder.

Avoid:

  • Turning off Block calls over the limit just to silence logs. The calls then reach your scripts again.
  • Adding events your scripts use to the honeypot list.
  • Relying on Event Guard alone. Your scripts should still check on the server that a reward is allowed.

Detections & Punishments

  • Event Guard uses the same punishments, cooldowns and alerts as every other detection.
  • Event abuse is logged as EventAbuse (Server event abuse).
  • See Detections & Punishments.

Remote Actions

  • The panel's Commands tab has Inject Event Guard and Remove Event Guard buttons.
  • They do the same as cxainject and cxauninject and ask for confirmation first.
  • See Remote Actions.

Console & Chat Commands

  • cxainject and cxauninject are console-only commands, so a staff member in game cannot edit your resources.
  • Their names are set in Configuration → Staff roles & commands → Commands.
  • See Console & Chat Commands.

Bans & the CXA Network

  • EventAbuse and BlacklistedEvent are in Shared detections by default, so automatic bans from them can be shared with the CXA network.
  • See Bans & the CXA Network.

Common Problems

"This command can only be used from the server console."

What you see: You typed /cxainject or /cxauninject in game chat and got this answer.

How to fix it:

  • Type the command in the server console or the txAdmin Live Console, without the slash.
  • Or use Commands → Inject Event Guard in the panel.

A Resource Was Skipped

What you see: The summary shows skipped resources and one of yours is not in the Injected: list.

How to fix it:

  • Check that the resource has server-side Lua. Client-only resources are skipped on purpose, they have no server events to protect.
  • Check Never inject into. The resource may be on the list.
  • If Skip escrowed resources is on, resources with an .fxap file are skipped.
  • If the resource already has the line, it is counted as "already had it", not as injected.

Players Get Kicked for "Server event abuse" During Normal Play

What you see: Honest players are kicked with Server event abuse, always for the same event.

How to fix it:

  • Read the event and resource fields in the log.
  • If the event fires often by design, for example a HUD or status sync, add it to Ignored events.
  • If it is a normal event that some actions call quickly, raise Max calls per event or Window.
  • If it is a strict event, raise Strict max calls a little.
  • Set Punishment to log while you test.

Event Guard Does Not Seem to Do Anything

What you see: You injected Event Guard, but spamming an event in a test does not trigger anything.

How to fix it:

  • Restart the server. The line only loads when the resource starts.
  • Open the resource's fxmanifest.lua and check that the line is there and above the resource's own server scripts.
  • Make sure CXA is running and the license is active. Without it, Event Guard lets every call through.
  • Test with a player who is not bypassed. Bypassed staff are never punished.
  • Check that the event is not in Ignored events.

© 2026 CodeXart Studios · CXA Anticheat