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

# Dispatch

Police alert and dispatch customization located in custom/client/dispatch.lua.

#### `DrugSellDispatch`

Called automatically on the client when a police alert chance is triggered during NPC drug selling.

**Supported Dispatch Systems**

* **qs-dispatch** (`exports['qs-dispatch']:DrugSale()`)
* **ps-dispatch** (`exports['ps-dispatch']:DrugSale()`)
* **cd\_dispatch** (`TriggerServerEvent('cd_dispatch:AddNotification', ...)`)
* **core\_dispatch** (`exports['core_dispatch']:addCall(...)`)
* **rcore\_dispatch** (`TriggerServerEvent('rcore_dispatch:server:sendAlert', ...)`)
* **op-dispatch** (`exports['op-dispatch']:CustomAlert(...)`)
* **aty\_dispatch** (`exports['aty_dispatch']:SendDispatch(...)`)
* **origen\_police / origen\_dispatch** (`exports['origen_police']:SendAlert(...)`)
* **tgiann-mdw / tgiann-dispatch** (`exports['tgiann-mdw']:addDispatch(...)`)
* **tk\_dispatch** (`exports.tk_dispatch:addCall(...)`)
* **wf-alerts** (`TriggerServerEvent('wf-alerts:svNotify', ...)`)
* **lb-phone** (`TriggerServerEvent('phone:sendJobNotification', ...)`)
* **Default Fallback** (`TriggerServerEvent('ak47_drugmanagerv3:policeAlert', coords, street)`)

**Example Customization**

```lua
DrugSellDispatch = function()
    local ped = PlayerPedId()
    local playerCoords = GetEntityCoords(ped)
    local streetHash, _ = GetStreetNameAtCoord(playerCoords.x, playerCoords.y, playerCoords.z)
    local street = GetStreetNameFromHashKey(streetHash)

    if GetResourceState('ps-dispatch') == 'started' then
        exports['ps-dispatch']:DrugSale()
    else
        -- Fallback default alert
        TriggerServerEvent('ak47_drugmanagerv3:policeAlert', playerCoords, street)
    end
end
```
