Add server SendAlert support for fd_dispatch

This commit is contained in:
Luke authored and GitHub committed 2026-04-19 16:20:44 +01:00
1 parent b7fb0ec21e
commit 5cc8a0cd68
1 file changed
+34 -1
+34 -1
View File
@@ -8,4 +8,37 @@ Dispatch.GetResourceName = function()
return 'fd_dispatch'
end
return Dispatch
Dispatch.SendAlert = function(data)
local metadata = {}
if data.vehicle then
table.insert(metadata, {
type = 'vehicle',
model = data.vehicle or locale('unknown_vehicle_model'),
plate = data.plate or nil,
color = data.colorHex or nil
})
end
if type(data.job) == "string" then
data.job = {data.job}
end
local coords = data.coords or nil
local alertData = {
source = data.source,
title = data.title or "No message provided",
description = data.message or "",
groups = data.jobs or data.job or {"police"},
code = data.code or '10-80',
priority = data.priority or 2,
metadata = metadata,
blip = {
radius = data.blip and data.blip.radius or 0,
sprite = data.blip and data.blip.sprite or 161,
color = data.blip and data.blip.color or 84,
scale = data.blip and data.blip.scale or 1.0,
time = data.time and (data.time / 1000) or nil,
},
}
exports.fd_dispatch:addAlert(alertData)
end
return Dispatch