On Player Server Banned

Fired after a ban on this server has been successfully recorded.

Parameters

  • src - Player server ID
  • token - Security token, must match the xerotoken convar
  • data - Table with the ban details (see Payload below)
  • delayDrop - Optional callback: call with a delay in milliseconds, from 0 to 20000

Payload (data table)

  • banId - The ID of the created ban
  • reason - Ban reason
  • description - Ban description
  • screenshotUrl - Screenshot URL (or nil)

Usage

AddEventHandler("xeroshield:onPlayerServerBanned", function(src, token, data, delayDrop)
    if not token or token ~= GetConvar("xerotoken", "") then
        return
    end

    delayDrop(4000) -- Delays DropPlayer by 4000 ms
    TriggerClientEvent("banscreen:show", src)
    print(string.format("Server banned: Id: %s Data: %s", src, json.encode(data)))
end)

This example triggers your own client-side banscreen:show event and delays the drop by 4 seconds. Implement that client event in your own resource; it is not a built-in XeroShield event. Logs, admin notifications, and webhook requests are not delayed. To keep the original immediate drop, omit the delayDrop argument and call.

Call delayDrop before yielding or starting asynchronous work. The maximum accepted delay is 20000 ms; if multiple handlers request a delay, the largest valid value is used. Values outside 0–20000 and non-number values are ignored.

On Player Server Banned | Documentation | XeroShield - FiveM AntiCheat