Electron Documentation

Security Rules

Create custom security rules to protect your server

Security rules let you automatically react to server events. When an event matches your conditions, Electron can block it, punish the player, log to Discord, or trigger a custom event.

Opening the rules page

Open the Electron panel and go to Settings > Rules. From here you can search existing rules or create a new one with Add Rule +.

Security rules list

Creating a rule

Click Add Rule + to open the rule editor.

Create security rule

Configure the following fields:

  1. Enabled - Toggle whether the rule is active after you deploy it.
  2. Rule name - A clear name so you can find the rule later.
  3. When an event matches - The server event that should trigger the rule.
  4. Conditions - Optional filters on the event data (field, operator, and value).
  5. Then... - One or more actions to run when the rule matches.

When you are done, click Deploy Rule.

Choosing an event

Under When an event matches, select the event you want to watch.

Event selection dropdown

Available events include:

EventTypical use
playerConnectingPlayer join / connection checks
entityCreatingVehicles, peds, or objects being created
entityRemovedEntities being removed
giveWeaponEventWeapons being given to a player
removeWeaponEventA specific weapon being removed
removeAllWeaponsEventAll weapons being cleared
weaponDamageEventWeapon damage being applied
fireEventFire-related network events
givePedScriptedTaskEventScripted ped tasks
clearPedTasksEventClearing ped tasks
ptfxEventParticle effects
explosionEventExplosions
startNetworkSyncedSceneEventSynced scenes
startProjectileEventProjectiles being started

Adding conditions

Use conditions to narrow when the rule should fire. Each condition has:

  • Field - The event property to check (for example data.model or data.entityType)
  • Operator - Comparison such as == equals
  • Value - The value to match

Use And / Or to combine multiple conditions. The Expression preview shows the final logic Electron will evaluate, for example:

data.model == 4222310262 and data.entityType == 2

If you need more control, click Edit expression to edit the expression directly.

Choosing actions

Under Then..., choose what should happen when the rule matches. You can add multiple actions with + Add Action.

Action selection dropdown
ActionWhat it does
Block eventStops the matched event from continuing
Ban playerBans the player responsible for the event
Kick playerKicks the player from the server
Warn playerCreates a warning for the player
Discord logSends a log message to Discord
Trigger eventFires a custom event you can handle in your own scripts

Example

A common setup is blocking creation of a specific vehicle model:

  1. Set the event to entityCreating.
  2. Add conditions for the model hash and entity type.
  3. Set the action to Block event.
  4. Keep Enabled on and click Deploy Rule.

Electron will then automatically block matching entityCreating events whenever those conditions are met.

On this page