Files
MrNewb 3a9424659b Refactor Dispatch.SendAlert for clarity
Assigns alert data to a local variable before passing it to exports.tk_dispatch:addCall, improving readability and maintainability.
2025-10-19 23:04:54 -04:00

30 lines
857 B
Lua

---@diagnostic disable: duplicate-set-field
if GetResourceState('tk_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local alertData = {
title = data.message,
code = data.code or '10-80',
priority = 'Priority 3',
coords = data.coords or GetEntityCoords(PlayerPedId()),
showLocation = true,
showGender = false,
playSound = true,
blip = {
color = data.blipData.color or 3,
sprite = data.blipData.sprite or 1,
scale = data.blipData.scale or 0.8,
},
jobs = data.jobs or {'police'},
}
exports.tk_dispatch:addCall(alertData)
end
---This will get the name of the in use resource.
---@return string
Dispatch.GetResourceName = function()
return 'tk_dispatch'
end
return Dispatch