Skip to content
sxsxPanel

Events API

React to bans, warnings, whitelist changes and more from your own resources.

sxPanel emits server-side events that your resources can listen to. This lets custom scripts react in real time to moderation actions, whitelist changes and server lifecycle events — without polling or extra database access.

Resource must be named `monitor`

sxPanel's FXServer resource is expected to be named monitor (this is the same convention txAdmin used). Exports are called as exports.monitor:....

Listening to events

Events are namespaced under txAdmin:events: (kept from the underlying txAdmin codebase sxPanel is built on) and fire with a single data table argument.

AddEventHandler('txAdmin:events:playerBanned', function(eventData)
  print(('Banned %s: %s'):format(eventData.targetName, eventData.reason))
end)

Server-side only

All Events API emissions happen server-side. Register your handlers in a server resource, never on the client.

Event reference

EventPayloadFires when
txAdmin:events:playerWarnedauthor, reason, actionId, targetNetId, targetIds, targetNameA player is warned
txAdmin:events:playerBannedauthor, reason, actionId, expiration, durationInput, durationTranslated, targetNetId, targetIds, targetHwids, targetName, kickMessageA player is banned
txAdmin:events:playerKickedtarget, author, reason, dropMessageA player is kicked
txAdmin:events:actionRevokedactionId, actionType, actionReason, actionAuthor, playerName, playerIds, playerHwids, revokedByA ban/warn is revoked (unbanned/unwarned)
txAdmin:events:whitelistPlayeraction ('added'|'removed'), license, playerName, adminNameA whitelist entry is added or removed
txAdmin:events:playerDirectMessagetarget, author, messageAn admin sends a player a direct message
txAdmin:events:announcementmessage, authorAn admin broadcasts a server announcement
txAdmin:events:scheduledRestartsecondsRemaining, translatedMessageA scheduled restart warning is sent
txAdmin:events:scheduledRestartSkippedsecondsRemaining, temporary, authorA scheduled restart is postponed/skipped
txAdmin:events:configChangedThe panel configuration is saved

There is no dedicated "server crashed" event — restart/crash handling is covered by the monitor logs surfaced in the panel and in Discord log routes.

Resource exports

All 10 exports live on the monitor resource (server-side only) and are called as exports.monitor:<name>(...). There are two families: tag exports (act on any player) and admin/action exports (the first argument is always the acting admin's server ID, not the target's — sxPanel looks that admin up and checks their permission before doing anything).

ExportParametersReturnsNotes
addPlayerTagserverId, tagIdboolean successtagId must already exist in Settings → Player Tags
removePlayerTagserverId, tagIdboolean successRemoves a previously-applied tag
hasPermissionserverId, permissionbooleanChecks if serverId (an admin) has the given permission, e.g. players.ban
isPlayerAdminserverIdbooleanWhether serverId is a logged-in sxPanel admin
getAdminUsernameserverIdstring | nilThe admin's username, or nil if not an admin
getAdminPermissionsserverIdtable | nilArray of the admin's permission strings, or nil
kickPlayerserverId, targetId, reason?serverId must have players.kick; logs to action history
banPlayerserverId, targetId, reason?, duration?serverId must have players.ban; duration e.g. '2 hours', '1 week', defaults to 'permanent'
warnPlayerserverId, targetId, reason?serverId must have players.warn; logs to action history
sendAnnouncementserverId, messageserverId must have announcement permission
-- tag exports: target the player directly
exports.monitor:addPlayerTag(targetServerId, 'donator')
exports.monitor:removePlayerTag(targetServerId, 'donator')

-- admin/action exports: first arg is the ADMIN performing the action
exports.monitor:hasPermission(adminServerId, 'players.ban') -- boolean
exports.monitor:isPlayerAdmin(adminServerId)                -- boolean
exports.monitor:getAdminUsername(adminServerId)
exports.monitor:getAdminPermissions(adminServerId)
exports.monitor:kickPlayer(adminServerId, targetServerId, reason)
exports.monitor:banPlayer(adminServerId, targetServerId, reason, duration)
exports.monitor:warnPlayer(adminServerId, targetServerId, reason)
exports.monitor:sendAnnouncement(adminServerId, message)

Next steps

On this page