Asphyxia fires a server event whenever something meaningful happens. Listen for these to post to your own Discord, alert staff in-game, sync a punishment to another system, or keep your own records. All of them are server-side, for your resources rather than for clients.
AddEventHandler("asphyxia:server:playerBanned", function(data)
print(("%s was banned: %s"):format(data.playerName, data.reason))
end)Bans
asphyxia:server:playerBanned fires on every ban — a detection, an admin, the
console, or your own scripts — with banId, playerId, playerName,
license, identifiers, reason, details and bannedBy.
asphyxia:server:playerUnbanned fires when one ban is lifted, with banId,
reason and revokedBy. asphyxia:server:allPlayersUnbanned fires when every
ban is lifted at once via asphyxia unbanall, with
lifted, reason and revokedBy.
Strikes and detections
asphyxia:server:playerStriked fires on every strike,
before any resulting ban, with strikeId, playerId, playerName, license,
reason, description, severity (low, medium or high) and
sessionCount — how many of this severity they have this session, so you can
warn staff before a ban happens.
asphyxia:server:detectionTriggered fires when a detection is confirmed, before
the resulting ban or strike, with playerId, playerName, detection,
detail, and strikeOnly (true if it strikes, false if it bans outright).
Whitelisted players never reach it.
asphyxia:server:riskScoreChanged fires when a player’s
risk score changes, with playerId, playerName,
license, previous and current.
Whitelists
asphyxia:server:playerWhitelisted fires when a detection
whitelist is added. Arguments are positional rather
than a table — license, detection, expiresAt (a Unix timestamp, or nil
until restart), grantedBy. asphyxia:server:whitelistRemoved fires when one
is lifted, with license and detection (nil when all were cleared at once).
Example: mirroring punishments to Discord
local WEBHOOK = "https://discord.com/api/webhooks/..."
local function post(text)
PerformHttpRequest(WEBHOOK, function() end, "POST", json.encode({
content = text,
}), { ["Content-Type"] = "application/json" })
end
AddEventHandler("asphyxia:server:playerBanned", function(data)
post(("**%s** was banned (%s). Ban ID: `%s`"):format(
data.playerName, data.reason, data.banId))
end)
AddEventHandler("asphyxia:server:playerStriked", function(data)
if data.severity ~= "high" then return end
post(("High-severity strike on **%s** (%s)"):format(data.playerName, data.reason))
end)