Create alert (server side)

Create alert, from server side.

Using provided export, you can simple trigger alert from server side. This is very much recommended method to do alerts, we’ve only included client side alerts, so we could provide you compatibility from other dispatches.

Usage

Export

---**`server`**
---@param payload ServerAlertPayload
---@return boolean | nil, string | nil
function exports.fd_dispatch:addAlert(payload) end

Payload

---@class BlipPayload
---@field title? string
---@field time? number
---@field coords vector3
---@field sprite? number
---@field radius? number
---@field color number
---@field scale number
---@field flashes? boolean
---@field category? number

---@class ServerAlertPayload
---@field source? number
---@field title string
---@field description? string
---@field groups string[]
---@field location? { coords: vector3, street: string }
---@field priority? number
---@field code? string
---@field radioChannel? number
---@field metadata AlertMetadataType[]
---@field isArchived? boolean
---@field isEmergency? boolean
---@field isAnonymous? boolean
---@field isShooting? boolean
---@field blip string | BlipPayload

Examples

Automatic location collection

Providing source to the payload, script will automatically call source via callback and get location information. Coordinates and street information.

local succ, err = exports.fd_dispatch:addAlert({
    source = source,
    title = 'Important alert',
    description = 'Very important alert. Go now!',
    groups = { 'police' },
    blip = 'shooting'
})

if not succ then
    print('Failed adding alert', err)
end

More details in alert

To alert, you can provide as much information as you want. Everything will displayed in it.

local succ, err = exports.fd_dispatch:addAlert({
    title = 'Important alert',
    description = 'Very important alert. Go now!',
    groups = { 'police' },
    location = {
        coords = vector3(0, 0, 0),
        street = 'Random Street'
    },
    priority = 2,
    code = '10-32',
    blip = 'shooting',
    metadata = {
        {
            type = 'general',
            content = 'Important information 1'
        },
        {
            type = 'general',
            content = 'Important information 2'
        }
    }
})

if not succ then
    print('Failed adding alert', err)
end

Anonymous alert

If you add isAnonymous to the payload, location will be stripped automatically from payload and alert will become anonymous.

local succ, err = exports.fd_dispatch:addAlert({
    title = 'Important alert',
    description = 'Very important alert. Go now!',
    groups = { 'police' },
    location = {
        coords = vector3(0, 0, 0),
        street = 'Random Street'
    },
    priority = 2,
    code = '10-32',
    blip = 'shooting',
    isAnonymous = true,
    metadata = {
        {
            type = 'general',
            content = 'Important information 1'
        },
        {
            type = 'general',
            content = 'Important information 2'
        }
    }
})

if not succ then
    print('Failed adding alert', err)
end

Alert with vehicle data

If you add isAnonymous to the payload, location will be stripped automatically from payload and alert will become anonymous.

local succ, err = exports.fd_dispatch:addAlert({
    title = 'Important alert',
    description = 'Very important alert. Go now!',
    groups = { 'police' },
    location = {
        coords = vector3(0, 0, 0),
        street = 'Random Street'
    },
    priority = 2,
    code = '10-32',
    blip = 'shooting',
    metadata = {
        {
            type = 'general',
            content = 'Important information 1'
        },
        {
            type = 'vehicle',
            model = 'Paragon 3',
            plate = 'XXX1234',
            color = '#123123'
        }
    }
})

if not succ then
    print('Failed adding alert', err)
end

Detailed information

source number

If provided, location will fetched from the provided source.

title string

Alert title

description string

Alert description.

groups string[]

Groups, which will see the alert and be informed about it.

location { coords: vector3, street: string }

Data about alert location.

priority number

Alert priority

code string

Alert code

radioChannel number

Dedicated alert radio channel, to which units will be able to join

metadata AlertMetadataType[]

Alert metadata, this is used to put various information into the alert.

isArchived boolean

Defines if alert is archived or not.

isEmergency boolean

Defines if alert is emergency or not. If it is, it will apply additional styles to it.

isAnonymous boolean

Defines if alert is anonymous or not.

isShooting boolean

Defines if alert is for shooting or not. Mostly used to suppress shots spam if it’s enabled in config, and count shots fired in the area.

blip string | BlipPayload

If you provide a string, it will try to check for predefined blips in config/alerts.lua -> predefinedBlips config. Otherwise, provide blip data.

Copyright © 2025 Felis Development