> For the complete documentation index, see [llms.txt](https://infinity-labs.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinity-labs.gitbook.io/docs/free-scripts/il-parking-meters/dispatch-integration.md).

# Dispatch Integration

### Dispatch Integration

Both police alerts — the quiet, chance-based one on a successful rob, and the loud one after too many failed attempts in a row — can be routed straight into a real dispatch/MDT resource instead of a bare native map blip. **You don't need to add anything to your police script or MDT** — this resource calls out to the dispatch resource directly, client-side, the moment an alert fires.

#### ps-dispatch (built in, works out of the box)

If you run [ps-dispatch](https://github.com/Project-Sloth/ps-dispatch), there's nothing to wire up. `Config.Dispatch.Resource` already defaults to `'ps-dispatch'`, and as long as it's installed and running, every alert is sent through its `CustomAlert` export — a proper entry in the MDT with its own title, radio code, icon, priority color, and blip, filtered to whichever jobs you list in `Config.Dispatch.Jobs` (defaults to `{ 'police' }`).

What you can tune in `config.lua`, per alert tier (both live together under `Config.Dispatch`):

* `Config.Dispatch.Silent` — the quiet/success alert: `Code` (radio code, e.g. `'10-31'`), `Icon` (Font Awesome class), `Priority` (`1` = red/urgent, `2` = default), `Sprite`/`Color` (map blip), `Length` (minutes it stays on the MDT map)
* `Config.Dispatch.Loud` — the loud/alarm alert, same fields

The actual alert **title text** comes from `locales/en.lua` (`police.silent_dispatch_title` / `police.loud_dispatch_title`), not `config.lua` — edit it there (or add another `locales/xx.lua` and point the resource at it) if you want different wording.

#### Using a different dispatch resource (cd\_dispatch, qs-dispatch, custom, etc.)

`ps-dispatch` is the only one wired up out of the box, since it's the one this resource ships tested against. To add support for another dispatch system:

1. Open `client/main.lua` and find the `RegisterNetEvent('IL-parkingmeters:client:dispatchAlert', ...)` handler. It receives `coords` and a `payload` table (`Message`, `Code`, `Icon`, `Priority`, `Sprite`, `Color`, `Length` — whatever's in the relevant `*Dispatch` config table, plus `Message`).
2. Add another branch alongside the existing `if Config.Dispatch.Resource == 'ps-dispatch' then` check, calling whatever export or event your dispatch resource exposes for a custom/generic alert — check that resource's own documentation for the exact call, since every dispatch script shapes its payload differently:

   ```lua
   elseif Config.Dispatch.Resource == 'your-dispatch' then
       exports['your-dispatch']:SomeAlertFunction({
           -- map payload.Message / payload.Code / etc. to whatever fields
           -- your-dispatch expects here
       })
   ```
3. Set `Config.Dispatch.Resource = 'your-dispatch'` in `config.lua`.

If you'd rather not integrate a dispatch resource at all, set `Config.Dispatch.Resource = ''` — every alert then falls back to a plain `QBCore:Notify` (and, for the loud alarm, a native map blip) sent directly to on-duty LEO, no dispatch resource required.
