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

# Sending alerts from your scripts

Send alerts to ALT0 Dispatch from any script.

## Server

```lua
exports['alt0-dispatch']:CreateDispatch({
    code = '10-90',
    title = 'Bank Robbery',
    description = 'Alarm triggered at Fleeca, Route 68',
    location = 'Route 68',
    coords = vector3(1176.0, 2706.0, 38.0),
    target = 'police',   -- 'police' (by zone), 'sheriff', 'law', 'ems' or 'all'
    duration = 15000,    -- ms the card stays up
})
```

| `target`    | Who receives the call                                                                  |
| ----------- | -------------------------------------------------------------------------------------- |
| `'police'`  | The agency whose zone contains `coords`. If nobody there is on duty, the other agency. |
| `'sheriff'` | The sheriff first. If nobody there is on duty, the city police.                        |
| `'law'`     | Every law enforcement job                                                              |
| `'ems'`     | EMS                                                                                    |
| `'all'`     | All police and EMS                                                                     |

While an area is jammed with `SetDispatchJammer`, calls from it are not sent.

## Client

```lua
exports['alt0-dispatch']:SendAlert({
    code = '10-31',
    title = 'Suspicious person',
    coords = GetEntityCoords(cache.ped),
})
```

Calls sent from the client are limited to one every 3 seconds per player, and their text is shortened.

## Other server exports

| Export                                       | What it does                          |
| -------------------------------------------- | ------------------------------------- |
| `GetRecentCalls()`                           | The current calls                     |
| `ClearCall(id, reason)`                      | Close a call                          |
| `GetJurisdiction(coords)`                    | Which zone a point is in              |
| `SetDispatchJammer(coords, radius, seconds)` | Block alerts from an area for a while |
| `IsLocationJammed(coords)`                   | Whether a point is jammed             |
| `Callsign(source)`                           | A player's callsign                   |

## Scripts written for other dispatch systems

Alerts sent the ps-dispatch, cd\_dispatch, nn\_dispatch or community\_bridge way arrive in ALT0 Dispatch without changes. Remove the original dispatch resource so ALT0 Dispatch can answer for it.
