txAdmindocs
Community integrations

txAdmin event examples for Lua resources

Copyable, defensive server-side Lua handlers for txAdmin announcements and restart notices, with event delivery limitations.

txAdmin broadcasts events named txAdmin:events:<name> to server resources. Handle the single table argument on the server, validate its fields, and do not treat the event stream as a durable audit database.

Log an announcement safely

AddEventHandler('txAdmin:events:announcement', function(data)
    if type(data) ~= 'table' or type(data.message) ~= 'string' then return end
    local author = type(data.author) == 'string' and data.author or 'txAdmin'
    print(('[txAdmin announcement] %s: %s'):format(author, data.message))
end)

This handler logs an event emitted by txAdmin. It is not an API to send announcements, nor a permission check to expose to clients.

React to scheduled restarts

AddEventHandler('txAdmin:events:scheduledRestart', function(data)
    if type(data) ~= 'table' then return end
    if data.secondsRemaining == 60 then
        print('[txAdmin] One minute until scheduled restart; prepare to persist state.')
        -- Call your framework's documented save method here.
    end
end)

Your framework may already save players on shutdown. Do not blindly add custom SQL or trigger a save routine without verifying the framework callback and restart timing.

Operational caveats

  • Events can be emitted while the game server is offline, so your resource can miss them. Do not use them as the only source for bans, allowlisting or audit records.
  • Keep examples in server-side resources; never trust client-supplied event payloads to authorize admin actions.
  • Use the current upstream event catalog for names, payload fields and version changes.
  • Integrating an outside site requires your own authenticated bridge, not an open unauthenticated endpoint. See txBridge for a third-party option.

Sources: Pinned upstream event reference, official txAdmin source.

On this page