Documentation

Police Alerts & Logging

NPC witnesses, dispatch alerts, and Discord logging.

#Witnesses

Each integration decides whether its grind is legal, for example a police officer removing a wheel clamp. Grinds that do not say use witnesses.defaultLegal. Legal grinds are never checked.

During an illegal grind, nearby NPCs are checked when the disc starts and again every recheckInterval. A ped notices the grind when it is within maxDistance and:

  • is within hearingDistance, without needing line of sight, or
  • has the grinder within its fieldOfView with a clear line of sight. Drivers use vehicleFieldOfView.

Players, dead peds, animals, and models in blacklistedModels never count. An integration can pass its own witness distance for a grind.

#Dispatch

The first witnessed check of a grind calls OnIllegalGrind in server/unlocked/hooks.lua, once per grind. Call your dispatch resource from there. The data includes the player, the coordinates, the integration's crime label, and the witnesses.

lua
---@param data IllegalGrindData
function OnIllegalGrind(data)
    -- Add dispatch exports or custom logic here
end

Other resources can listen to the zyke_anglegrinder:IllegalGrindWitnessed server event instead. See Exports & Events.

Set witnesses.debug = true to print each check's result to the console while testing.

#Discord Logging

server/unlocked/hooks.lua logs grind starts, completions, and failures, broken discs, depleted batteries, and witnessed illegal grinds through zyke_lib.

Copy extras/webhooks/anglegrinder.lua to zyke_lib/webhooks/anglegrinder.lua and set a URL for each action you want logged. Empty URLs disable that action. Restart zyke_anglegrinder after changing them.

lua
return {
    GrindStart = "",
    GrindComplete = "",
    GrindFailed = "",
    DiscBroken = "",
    BatteryDepleted = "",
    IllegalGrindWitnessed = "",
}