On Player Kicked

Fired after a kick has been successfully recorded, before the player is dropped.

Parameters

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

Payload (data table)

  • kickId - The ID of the created kick
  • reason - Kick reason
  • description - Kick description
  • screenshotUrl - Screenshot URL (or nil)

Usage

AddEventHandler("xeroshield:onPlayerKicked", 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("Kicked: 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 Kicked | Documentation | XeroShield - FiveM AntiCheat