API ReferenceGE Extensionsui
Police Info
Sends police pursuit data to the UI HUD every frame.
Sends police pursuit data to the UI HUD every frame.
Overview
ui_policeInfo reads the player vehicle's pursuit state from gameplay_police and pushes it to the CEF UI via the PoliceInfoUpdate guihook. It displays pursuit level, sight value, arrest/evade progress, duration, police count, and offense alerts.
Extension path: lua/ge/extensions/ui/policeInfo.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
onGuiUpdate | (dt) | Called each GUI frame; sends pursuit data to UI. |
onVehicleSwitched | (_, id) | Resets pursuit display when player switches vehicle. |
onPursuitOffense | (vehId, name, data) | Fires a one-frame offense alert for the player vehicle. |
Fields
| Field | Type | Default | Description |
|---|---|---|---|
M.enabled | bool | true | Master toggle; when false, no data is sent. |
Internals
lastPursuitData
{
pursuitLevel = 0, -- pursuit mode (0 = none)
sightValue = 0, -- police sight/detection value
arrest = 0, -- arrest timer progress (lerped)
evade = 0, -- evade timer progress (lerped)
info = '', -- array of {txt, key} or empty string
alert = '', -- one-frame offense alert or nil
}Info Fields
When pursuit is active (mode > 0), info is an array of:
{txt, key='duration'}- formatted asMM:SS{txt, key='policeCount'}- number of police units{txt, key='uniqueOffensesCount'}- unique infractions
Lerped Progress
arrest and evade are smoothed with lerp(..., 0.5) to animate the progress bar nicely in the UI, especially when values reset to zero.
How It Works
- Each GUI frame,
onGuiUpdatechecksgameplay_police.getPursuitData(). - If no pursuit exists, resets to zero if needed.
- Otherwise updates pursuit level, sight, arrest/evade (lerped), and info fields.
- Triggers
PoliceInfoUpdatewith the data table. - Clears
alertafter one frame (it's a ping).
Lua Examples
-- Disable police HUD
extensions.ui_policeInfo.enabled = false
-- Re-enable
extensions.ui_policeInfo.enabled = trueHooks Triggered
| Hook | Payload | When |
|---|---|---|
PoliceInfoUpdate (guihook) | lastPursuitData | Every GUI frame during pursuit |
Additional Exports
The following exports are available but not yet documented in detail:
M.onGuiUpdateM.onPursuitOffenseM.onVehicleSwitched