Exports
Electron Anticheat provides server-side exports to enhance server management and player moderation. These functions allow you to programmatically whitelist players temporarily, enforce punishments, and listen for related events.
Temporarily Whitelisting Players
To grant temporary exceptions to specific players for certain anticheat modules:
-- Whitelist a player
exports["ElectronAC"]:tempWhitelistPlayer(source, module)
-- Unwhitelist a player
exports["ElectronAC"]:tempUnWhitelistPlayer(source, module)
Arguments
-
source
(number
):
The network ID of the player. -
module
(string
):
The anticheat module (e.g.,antiTeleport
,antiNoclip
,antiVehicle
).
Punishing Players
To take action against players violating server rules:
-- Ban a player
exports["ElectronAC"]:banPlayer(source, reason, details, overrideWhitelist)
-- Warn a player
exports["ElectronAC"]:warnPlayer(source, reason, details, overrideWhitelist)
-- Kick a player
exports["ElectronAC"]:kickPlayer(source, reason, details, overrideWhitelist)
Arguments
-
source
(number
):
The network ID of the player. -
reason
(string
):
The reason for the action, displayed in logs and dashboards. -
details
(string
):
Additional information about the action. -
overrideWhitelist
(boolean
):
Iftrue
, even whitelisted players will be affected.
Listening to Events
Set up event listeners to respond to player actions:
-- Listen for a ban event
AddEventHandler("ElectronAC:playerBanned", function(source, reason, details, automatic)
-- Your code here
end)
-- Listen for a warning event
AddEventHandler("ElectronAC:playerWarned", function(source, reason, details, automatic)
-- Your code here
end)
-- Listen for a kick event
AddEventHandler("ElectronAC:playerKicked", function(source, reason, details)
-- Your code here
end)
Arguments
-
source
(number
):
The network ID of the player. -
reason
(string
):
The reason for the action. -
details
(string
):
Additional details about the action. -
automatic
(boolean
):
Indicates if the action was automatically applied (true
) or manually triggered (false
).
Retrieving Player Bans
To retrieve a list of bans for a specific player based on their identifiers:
-- Get bans for a player by Discord ID
local bans = exports["ElectronAC"]:getPlayerBans({ discord = "497805027872735242" })
Arguments
identifiers
(table
):
A table containing one or more player identifiers to search for bans. Examples of identifiers:discord
,steam
,license
,ip
, etc.
Returns
bans
(table
):
An array of ban records for the specified identifiers. Each ban record has the following structure:{ "name": string, "identifiers": Identifiers, "reason": string, "banId": string, "details": string, "advanced": boolean }