> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-dispatch/developer-guide/raising-calls.md).

# Raising Calls

One export, the same shape on the server and the client.

```lua
exports['mango_dispatch']:CreateCall({
    code = '10-90',
    title = 'Robbery - Convenience Store',
    description = 'Masked male with a handgun took the register.',
    callerName = 'Priya Kapoor',
    callerNumber = '555-0102',
    tags = { 'weapon', 'robbery' },
    x = 25.7, y = -1347.3, z = 29.5,
    street = 'Innocence Blvd',
    suburb = 'Strawberry',
    sound = 'dispatch-alert.mp3',
    silent = false,
})
```

Every field is optional except the coordinates on the server. Full descriptions and limits are on [Call Fields](/mango5m-docs/resources/mango-dispatch/developer-guide/call-fields.md).

### Server vs client

{% tabs %}
{% tab title="Server" %}

```lua
local id = exports['mango_dispatch']:CreateCall({
    code = '10-31',
    title = 'Shots Fired',
    x = coords.x, y = coords.y, z = coords.z,
})
```

Returns the **call id**, or `nil` if the coordinates were missing or invalid. Not rate limited.

You must supply coordinates - the server has no ped to read them from.
{% endtab %}

{% tab title="Client" %}

```lua
exports['mango_dispatch']:CreateCall({
    code = '10-31',
    title = 'Shots Fired',
})
```

Returns `true` immediately - the call is created on the server, so there is no id to hand back.

Coordinates, street and area are filled in from **your own ped** when you leave them out, which is usually what you want for a crime that happens where the player is standing. Rate limited to one call every `clientCall.cooldownSeconds` (default 5) per player.
{% endtab %}
{% endtabs %}

### A worked example

A store robbery script, server side:

```lua
RegisterNetEvent('myrobbery:started', function(storeId)
    local src = source
    local ped = GetPlayerPed(src)
    local coords = GetEntityCoords(ped)

    exports['mango_dispatch']:CreateCall({
        code = '10-90',
        title = ('Robbery in Progress - %s'):format(Stores[storeId].label),
        description = 'Silent alarm triggered at the register.',
        callerName = 'Silent Alarm',
        tags = { 'robbery', 'alarm' },
        x = coords.x, y = coords.y, z = coords.z,
    })
end)
```

Nothing else is needed. Every unit gets the card, the call appears in the window, and it closes itself after an hour if nobody attends.

### Common patterns

| Want                                        | Do                                                      |
| ------------------------------------------- | ------------------------------------------------------- |
| A board entry with no interruption          | `silent = true`                                         |
| A distinct tone for priority calls          | `sound = 'priority.mp3'` with the file in `web/sounds/` |
| Your own street label instead of the game's | Pass `street` and `suburb` explicitly                   |
| To close it yourself later                  | Keep the returned id and call `RemoveCall(id)`          |

### Cancelling a call you raised

```lua
local id = exports['mango_dispatch']:CreateCall({ ... })

-- when the robbery ends on its own
exports['mango_dispatch']:RemoveCall(id)
```

`RemoveCall` resolves the call silently - no Code 4 notification, no officer attribution - and clears everyone's route. It returns `true` if the call was open.

### Compatibility alias

```lua
exports['mango_dispatch']:CreateDispatchCall(data)   -- returns ok, idOrError
```

Kept so scripts written against the older export name keep working unchanged. New code should use `CreateCall`.
