This commit is contained in:
Nordi98 2025-08-06 16:37:06 +02:00
parent 510e3ffcf2
commit f43cf424cf
305 changed files with 34683 additions and 0 deletions

View file

@ -0,0 +1,32 @@
---@diagnostic disable: duplicate-set-field
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)
TriggerServerEvent('community_bridge:Server:DispatchAlert', {
sprite = data.blipData.sprite or 161,
color = data.blipData.color or 1,
scale = data.blipData.scale or 0.8,
vehicle = data.vehicle or nil,
plate = data.vehicle and GetVehicleNumberPlateText(data.vehicle) or nil,
ped = data.ped or cache.ped,
pedCoords = data.pedCoords or GetEntityCoords(cache.ped),
coords = data.coords or GetEntityCoords(cache.ped),
message = data.message or "An Alert Has Been Made",
code = data.code or '10-80',
icon = data.icon or 'fas fa-question',
jobs = data.jobs or {'police'},
time = data.time or 100000
})
end
RegisterNetEvent('community_bridge:Client:DispatchAlert', function(alert)
Notify.SendNotify(alert.message, "success", 15000)
local blip = Bridge.Utility.CreateBlip(alert.coords, alert.sprite, alert.color, alert.scale, alert.code, true)
Wait(alert.time)
Bridge.Utility.RemoveBlip(blip)
end)
return Dispatch

View file

@ -0,0 +1,13 @@
Dispatch = Dispatch or {}
RegisterNetEvent("community_bridge:Server:DispatchAlert", function(data)
local jobs = data.jobs
for _, name in pairs(jobs) do
local activeJobPlayers = Bridge.Framework.GetPlayersByJob(name)
for _, src in pairs(activeJobPlayers) do
TriggerClientEvent('community_bridge:Client:DispatchAlert', src, data)
end
end
end)
return Dispatch

View file

@ -0,0 +1,18 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('bub-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local alertData = {
code = data.code or '10-80',
offense = data.message,
coords = data.coords or GetEntityCoords(cache.ped),
info = { label = data.code or '10-80', icon = data.icon or 'fas fa-question' },
blip = data.blipData.sprite or 1,
isEmergency = data.priority == 1 and true or false,
blipCoords = data.coords or cache.ped and GetEntityCoords(cache.ped) or { x = 0, y = 0},
}
exports["bub-mdt"]:CustomAlert(alertData)
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('bub-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,27 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('cd_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local plyrData = exports['cd_dispatch']:GetPlayerInfo()
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = data.jobs,
coords = data.coords,
title = data.message,
message = data.message,
flash = 0,
unique_id = plyrData.unique_id,
sound = 1,
blip = {
sprite = data.blipData.sprite,
scale = data.blipData.scale,
colour = data.blipData.color,
flashes = false,
text = data.message,
time = (data.time / 1000),
radius = 0,
}
})
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('cd_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,30 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('kartik-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local repackJobsBools = {}
for k, v in pairs(data.jobs) do
if v then
repackJobsBools[k] = true
end
end
local alertOptions = {
title = data.message or "Alert",
code = data.code or '10-80',
description = data.message,
type = "Alert",
coords = data.coords,
blip = {
radius = 100.0,
sprite = data.blipData.sprite or 161,
color = data.blipData.color or 1,
scale = data.blipData.scale or 0.8,
length = 2
},
jobs = repackJobsBools,
}
exports['kartik-mdt']:CustomAlert(alertOptions)
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('kartik-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,43 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('lb-tablet') == 'missing' then return end
Dispatch = Dispatch or {}
local function getPriorityLevel(priority)
if priority == 1 then
return 'low'
elseif priority == 2 then
return 'medium'
elseif priority == 3 then
return 'high'
else
return 'medium'
end
end
---This will send an alert to the passed jobs
---@param data table
Dispatch.SendAlert = function(data)
local streetName, _ = Utility.GetStreetNameAtCoords(data.coords)
local priority = getPriorityLevel(data.priority)
if type(data.jobs) == 'table' then
data.jobs = data.jobs[1]
end
if data.time and data.time > 1000 then
data.time = math.floor((data.time / 1000) + 0.5)
end
local alertData = {
priority = priority,
code = data.code or '10-80',
title = 'Dispatch Alert!',
description = data.message,
location = {
label = streetName,
coords = vec2(data.coords.x, data.coords.y)
},
time = data.time or 10000,
job = data.jobs,
}
TriggerServerEvent("community_bridge:server:dispatch:sendAlert", alertData)
end
return Dispatch

View file

@ -0,0 +1,8 @@
if GetResourceState('lb-tablet') == 'missing' then return end
Dispatch = Dispatch or {}
RegisterNetEvent("community_bridge:server:dispatch:sendAlert", function(data)
exports["lb-tablet"]:AddDispatch(data) -- this has a return value but we dont really have a use for it atm.
end)
return Dispatch

View file

@ -0,0 +1,21 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('linden_outlawalert') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
TriggerServerEvent('wf-alerts:svNotify', {
dispatchData = {
displayCode = data.code or '211',
description = data.message or "Alert",
isImportant = 0,
recipientList = data.jobs or {'police'},
length = data.time or '10000',
infoM = data.icon or 'fas fa-question',
info = data.message or "Alert"
},
caller = 'Anonymous',
coords = data.coords or GetEntityCoords(cache.ped)
})
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('linden_outlawalert') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,27 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('origen_police') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local color = nil
if data.vehicle then
local r, g, b = GetVehicleColor(data.vehicle)
color = {r, g, b}
end
local customData = {
coords = data.coords or vector3(0.0, 0.0, 0.0),
title = 'Alert '..(data.code or '10-80'),
message = data.message,
job = data.jobs or 'police',
metadata = {
model = data.vehicle and (GetDisplayNameFromVehicleModel(GetEntityModel(data.vehicle))) or nil,
color = color,
plate = data.vehicle and GetVehicleNumberPlateText(data.vehicle) or nil,
speed = data.vehicle and (GetEntitySpeed(veh) * 3.6)..' kmh' or nil
}
}
TriggerServerEvent("SendAlert:police", customData)
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('origen_police') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,33 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('ps-dispatch') == 'missing' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local alertData = {
message = data.message,
code = data.code or '10-80',
icon = data.icon or 'fas fa-question',
priority = 2,
coords = data.coords,
vehicle = data.vehicle,
plate = data.plate,
alertTime = (data.time or 10000) / 1000,
alert = {
radius = 0,
recipientList = data.jobs,
sprite = data.blipData.sprite,
color = data.blipData.color,
scale = data.blipData.scale,
length = 2,
sound = "Lose_1st",
sound2 = "GTAO_FM_Events_Soundset",
offset = false,
flash = false
},
jobs = data.jobs
}
exports["ps-dispatch"]:CustomAlert(alertData)
end
return Dispatch

View file

@ -0,0 +1,5 @@
if GetResourceState('ps-dispatch') == 'missing' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,41 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qs-dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local playerData = exports['qs-dispatch']:GetPlayerInfo()
if not playerData then return print("Error getting player data") end
local customData = {
job = data.jobs or { 'police'},
callLocation = data.coords or vec3(0.0, 0.0, 0.0),
callCode = {
code = data.code or '10-80',
snippet = data.snippet or 'General Alert'
},
message = data.message,
flashes = false,
image = nil,
blip = {
sprite = data.blipData.sprite or 1,
scale = data.blipData.scale or 1.0,
colour = data.blipData.color or 1,
flashes = false,
text = data.message or "Alert",
time = data.length and (data.time * 1000) or 20000
},
otherData = {
{
text = data.name or 'N/A',
icon = data.icon or 'fas fa-question'
}
}
}
exports['qs-dispatch']:getSSURL(function(image)
customData.image = image or customData.image
TriggerServerEvent('qs-dispatch:server:CreateDispatchCall', customData)
end)
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('qs-dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch

View file

@ -0,0 +1,17 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('redutzu-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local streetName, _ = Utility.GetStreetNameAtCoords(data.coords)
local alertData = {
code = data.code or '10-80',
message = data.message or "Dispatch Alert",
street = streetName,
time = data.time or 10000,
coords = data.coords,
}
TriggerServerEvent("community_bridge:server:dispatch:sendAlert", alertData)
end
return Dispatch

View file

@ -0,0 +1,14 @@
if GetResourceState('redutzu-mdt') == 'missing' then return end
Dispatch = Dispatch or {}
RegisterNetEvent("community_bridge:server:dispatch:sendAlert", function(data)
TriggerEvent('redutzu-mdt:server:addDispatchToMDT', {
code = data.code,
title = data.message,
street = data.street,
duration = data.time,
coords = data.coords
})
end)
return Dispatch

View file

@ -0,0 +1,23 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('tk_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
exports.tk_dispatch:addCall({
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'},
})
end
return Dispatch

View file

@ -0,0 +1,4 @@
if GetResourceState('tk_dispatch') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch