2025-09-28 17:26:03 +01:00
|
|
|
if GetResourceState('fd_dispatch') == 'missing' then return end
|
|
|
|
|
if GetResourceState('lb-tablet') == 'started' then return end
|
|
|
|
|
Dispatch = Dispatch or {}
|
|
|
|
|
|
|
|
|
|
---This will get the name of the in use resource.
|
|
|
|
|
---@return string
|
|
|
|
|
Dispatch.GetResourceName = function()
|
|
|
|
|
return 'fd_dispatch'
|
|
|
|
|
end
|
|
|
|
|
|
2026-04-19 16:20:44 +01:00
|
|
|
Dispatch.SendAlert = function(data)
|
|
|
|
|
local metadata = {}
|
|
|
|
|
if data.vehicle then
|
|
|
|
|
table.insert(metadata, {
|
|
|
|
|
type = 'vehicle',
|
2026-08-18 00:02:04 -07:00
|
|
|
model = data.vehicle or lib.locale('unknown_vehicle_model'),
|
2026-04-19 16:20:44 +01:00
|
|
|
plate = data.plate or nil,
|
|
|
|
|
color = data.colorHex or nil
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
if type(data.job) == "string" then
|
|
|
|
|
data.job = {data.job}
|
|
|
|
|
end
|
2026-04-19 17:10:57 +01:00
|
|
|
local coords = data.coords or GetEntityCoords(GetPlayerPed(data.source))
|
2026-04-19 16:20:44 +01:00
|
|
|
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 = {
|
2026-04-19 17:10:57 +01:00
|
|
|
title = data.title or "No message provided",
|
|
|
|
|
coords = coords,
|
|
|
|
|
radius = data.blip and data.blip.radius or nil,
|
2026-04-19 16:20:44 +01:00
|
|
|
sprite = data.blip and data.blip.sprite or 161,
|
2026-04-19 17:10:57 +01:00
|
|
|
color = data.blip and data.blip.color or 1,
|
|
|
|
|
scale = data.blip and data.blip.scale or 1.2,
|
|
|
|
|
flashes = data.blip.flash or false,
|
|
|
|
|
time = data.time or (6 * 60000),
|
|
|
|
|
category = data.category or nil,
|
2026-04-19 16:20:44 +01:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
exports.fd_dispatch:addAlert(alertData)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return Dispatch
|