Create alert (client side)

Create alert, from client side.

Using provided event, you can simple trigger alert from client side. We do not recommend this method, that’s why you should always send alerts from server side.

More information on how to send alerts from server side.

Usage

Export

---**`client`**
---@param payload ClientAlertPayload
function exports.fd_dispatch:CustomAlert(payload) end

Event

---@param data
TriggerServerEvent('fd_dispatch:events:addAlert', data)

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 ClientAlertPayload
---@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

Alert with vehicle data

By adding local vehicleData = require 'modules.composables.client.vehicleData' to your lua file, you can utialise useful vehicle data for your alerts.

local data = vehicleData(cache.vehicle)
if not data then return end
local metadata = {}

table.insert(metadata, {
    type = 'vehicle',
    model = data.name or locale('unknown_vehicle_model'),
    plate = data.plate or nil,
    color = data.colorHex or nil
})

local data = {
    title = locale('alerts_vehicle_theft_title'),
    description = locale('alerts_vehicle_theft_desc'),
    blip = {
        sprite = 595,
        color = 60,
        scale = 1.2,
        time = 15 * 1000
    },
    groups = { 'police' },
    priority = 2,
    code = '10-35',
    location = locationData(),
    metadata = metadata,
    isShooting = true
}

TriggerServerEvent('fd_dispatch:events:addAlert', data)

Emergency alert

local framework = require 'modules.bridge.framework'
local locationData = require 'modules.composables.client.locationData'

local metadata = {}

local name = framework.getName()
table.insert(metadata, {
    content = name,
    icon = 'fas fa-skull'
})

local data = {
    title = locale('alerts_officer_down_title'),
    description = locale('alerts_officer_down_desc'),
    blip = {
        sprite = 52,
        color = 1,
        scale = 1.2,
        time = 15 * 1000
    },
    groups = { 'ambulance', 'police' },
    priority = 1,
    code = '10-99',
    location = locationData(),
    metadata = metadata,
    isEmergency = true
}

TriggerServerEvent('fd_dispatch:events:addAlert', data)

Detailed information

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