On Player Global Banned

Fired after a global ban 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:onPlayerGlobalBanned", function(src, token, data, delayDrop)
    if not token or token ~= GetConvar("xerotoken", "") then
        return
    end

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

This example delays only the drop by 4 seconds. 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 Global Banned | Documentation | XeroShield - FiveM AntiCheat