Custom Events

txAdmin sends server events to allow for integration of some functionalities with other resources. The event name will be txAdmin:events:<name> and the first (and only) parameter will be a table that may contain relevant data.

Important:

Do not fully rely on events where consistency is key since they may be executed while the server is not online; therefore, your resource would not be notified about it. For instance, while the server is stopped one could whitelist or ban player identifiers.

txAdmin:events:scheduledRestart (v3.2)

Broadcasted automatically [30, 15, 10, 5, 4, 3, 2, 1] minutes before a scheduled restart. Can be used with the convar txAdmin-hideDefaultScheduledRestartWarning to display a custom warning notification.

Event Data:

  • secondsRemaining: The number of seconds before the scheduled restart.
  • translatedMessage: The translated message to show on the announcement.

Example usage on ESX v1.2:

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

AddEventHandler('txAdmin:events:scheduledRestart', function(eventData)
    if eventData.secondsRemaining == 60 then
        CreateThread(function()
            Wait(45000)
            print("15 seconds before restart... saving all players!")
            ESX.SavePlayers(function()
                -- do something
            end)
        end)
    end
end)

txAdmin:events:playerKicked (v3.7)

Broadcasted when a player is kicked using txAdmin.

Event Data:

  • target: The ID of the player that was kicked.
  • author: The name of the admin.
  • reason: The reason for the kick.

txAdmin:events:announcement (v4.8)

Broadcasted when an announcement is made using txAdmin. Can be used with the convar txAdmin-hideDefaultAnnouncement to display custom announcement notifications.

Event Data:

  • author: The name of the admin or txAdmin.
  • message: The message of the broadcast.

txAdmin:events:adminAuth (v6.0.1)

Broadcasted whenever an admin is authenticated in-game or loses admin permissions. This event is particularly useful for anti-cheats to ignore txAdmin admins.

Event Data:

  • netid: The ID of the player or -1 when revoking the permission of all admins (forced reauth).
  • isAdmin: If the player is an admin or not.
  • username: The txAdmin username of the admin that was authenticated.