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

# Usage

### Player Usage Guide

* **Opening the Menu:** Press **F7** or type `/dispatchmenu` to open the dispatch interface.
* **Browsing Calls:** Use the search bar to filter dispatches by title, location, or suspect details. You can also filter by categories (e.g., Vehicle, Downed).
* **Viewing Details:** Click on a dispatch card to see exact details like distance in meters, urgency, and to focus the blip on your map.
* **Responding:** When a dispatch comes in, press **G** to notify other units you are responding, or press **H** to clear your responder status.

### Developer & Customization Notes

The user interface is built using **Vue.js** (source code available in the `web` folder) and communicates with the game client via NUI Events.

* **UI Source Code:** Find the frontend source inside the `web/` directory. (Use `npm run build` after making modifications)
* **NUI Actions:** Handled in `web/src/utils/nui-events.js` (includes `openMenu`, `addDispatch`, `updateGps`, `respond`, etc.)
* **Escrow / Open Source:** Core configuration (`shared/*.lua`) and client checks (`client/checks.lua`) are completely unescrowed for easy modification.

### Developer API (Exports & Events)

To trigger custom dispatches from your own scripts, you can use the built-in export (Client-Side) or server/client events.

#### Client-Side Export

You can use the `SendDispatch` export directly from any client script. This is the recommended method.

```lua
exports["aty_dispatchv2"]:SendDispatch({
    title = "Bank Robbery",           -- Required: Title of the dispatch
    code = "10-90",                   -- Required: Dispatch code
    blipType = 161,                   -- Optional: Blip sprite ID (default: 1)
    blipName = "Bank Robbery",        -- Optional: Name of the blip on the map
    icon = "shooting-bg.svg",         -- Optional: Icon for the UI (default: officer-bg.svg)
    urgent = true,                    -- Optional: Emphasizes the dispatch in the UI
    isUnknown = true,                 -- Optional: Hides the player's name and shows "Unknown"
    jobs = {"police", "sheriff"},     -- Optional: Specific jobs that will receive this dispatch
    coords = vector3(x, y, z),        -- Optional: Custom coordinates (defaults to player pos)
    colors = {"FFFFFF", "FFFFFF"}     -- Optional: Hex gradients for the UI (defaults to job colors)
})
```

#### Server & Client Events

Alternatively, if you are calling it from the server, you can trigger events to achieve the same result.

**From Server-Side to Server:**

```lua
-- dispatchData takes the same table structure as the export above
-- jobsTable is an array of jobs that should receive it (e.g. {"police"})
TriggerEvent("aty_dispatchv2:server:sendDispatch", dispatchData, jobsTable)
```

**From Client-Side to Client:**

```lua
-- dispatchData takes the same table structure as the export above
TriggerEvent("aty_dispatchv2:client:sendDispatch", dispatchData)
```
