Merge pull request #163 from divide29/main
add integration for emergencydispatch
This commit is contained in:
2 files changed
+43
No files matched your search
@@ -0,0 +1,25 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('emergencydispatch') == 'missing' then return end
|
||||
Dispatch = Dispatch or {}
|
||||
|
||||
---This will send an alert to currently supported dispatch systems.
|
||||
---@param data table The data to send to the dispatch system.
|
||||
---@return nil
|
||||
Dispatch.SendAlert = function(data)
|
||||
local ped = PlayerPedId()
|
||||
|
||||
local job = data.job or data.jobs[1] or 'police'
|
||||
local message = data.message or "An Alert Has Been Made"
|
||||
local coords = data.coords or GetEntityCoords(ped)
|
||||
|
||||
-- The last boolean argument is unknown. The developer always uses true.
|
||||
TriggerServerEvent('emergencydispatch:emergencycall:new', job, message, coords, true)
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Dispatch.GetResourceName = function()
|
||||
return 'emergencydispatch'
|
||||
end
|
||||
|
||||
return Dispatch
|
||||
@@ -0,0 +1,18 @@
|
||||
if GetResourceState('emergencydispatch') == 'missing' then return end
|
||||
Dispatch = Dispatch or {}
|
||||
|
||||
RegisterNetEvent("community_bridge:server:dispatch:sendAlert", function(data)
|
||||
local job = data.job or data.jobs[1] or 'police'
|
||||
local message = data.message or "An Alert Has Been Made"
|
||||
local coords = data.coords or vector3(0, 0, 0)
|
||||
|
||||
TriggerEvent('emergencydispatch:emergencycall:new', job, message, coords, true)
|
||||
end)
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Dispatch.GetResourceName = function()
|
||||
return 'emergencydispatch'
|
||||
end
|
||||
|
||||
return Dispatch
|
||||
Reference in new issue
Block a user