dispatches updated

This commit is contained in:
MrNewb committed 2025-02-05 20:43:44 -05:00
1 parent 8900822234
commit b829edb835
16 files changed
+170 -175

No files matched your search

-3
View File
@@ -10,8 +10,6 @@ shared_scripts {
'@ox_lib/init.lua',
'lib/init.lua',
'settings/sharedConfig.lua',
'use/*.lua',
'modules/utility/shared/*.lua',
'modules/math/*.lua',
'modules/locales/*.lua',
}
@@ -37,7 +35,6 @@ server_scripts {
client_scripts {
'settings/clientConfig.lua',
'modules/locales/shared.lua',
'modules/utility/client/*.lua',
'modules/framework/**/client.lua',
'modules/inventory/**/client.lua',
'modules/doorlock/**/client.lua',
@@ -0,0 +1,51 @@
Dispatch = Dispatch or {}
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.blipData.sprite, alert.blipData.color, alert.blipData.scale, alert.code, true)
Wait(alert.time)
Bridge.Utility.RemoveBlip(blip)
end)
--[[
RegisterCommand('testalert', function(source, args)
print('sending alert')
local ped = cache.ped
local vehicle = cache.vehicle
Dispatch.SendAlert({
vehicle = vehicle or nil,
plate = vehicle and GetVehicleNumberPlateText(vehicle) or nil,
ped = ped,
pedCoords = ped and GetEntityCoords(ped),
coords = GetEntityCoords(ped),
blipData = {
sprite = 161,
color = 1,
scale = 0.8,
},
message = "Vehicle is being stolen",
code = '10-80',
icon = 'fas fa-question',
jobs = {'police'},
alertTime = 10
})
end, false)
--]]
@@ -0,0 +1,11 @@
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)
@@ -0,0 +1,15 @@
if GetResourceState('bub-mdt') ~= 'started' 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
@@ -0,0 +1,2 @@
if GetResourceState('bub-mdt') ~= 'started' then return end
Dispatch = Dispatch or {}
-18
View File
@@ -1,18 +0,0 @@
if GetResourceState('cd_dispatch') ~= 'started' then return end
Dispatch = {}
Dispatch.SendAlert = function(data)
local playerData = exports['cd_dispatch']:GetPlayerInfo()
local randomID = Utility.CreateUniqueId(nil, 14, nil)
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = data.job,
coords = data.coords or playerData.coords,
title = data.code or '10-80',
message = data.message,
flash = 0,
unique_id = randomID,
sound = 1,
blip = { sprite = 431, scale = 1.2, colour = 3, flashes = false, text = data.message, time = 10000, radius = 0, }
})
end
@@ -1,21 +0,0 @@
if GetResourceState('linden_outlawalert') ~= 'started' then return end
Dispatch = {}
Dispatch.SendAlert = function(data)
local formattedData = {
displayCode = data.code or '10-80',
description = data.message,
isImportant = data.priority or 0,
recipientList = data.job,
length = '10000',
infoM = data.icon or 'fas fa-question',
info = data.message
}
local dispatchData = {
dispatchData = formattedData,
caller = 'Anonymous',
coords = GetEntityCoords(cache.ped)
}
TriggerServerEvent('wf-alerts:svNotify', dispatchData)
end
@@ -0,0 +1,18 @@
if GetResourceState('linden_outlawalert') ~= 'started' 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.alertTime * 1000) or '10000',
infoM = data.icon or 'fas fa-question',
info = data.message or "Alert"
},
caller = 'Anonymous',
coords = data.coords or GetEntityCoords(cache.ped)
})
end
@@ -0,0 +1,2 @@
if GetResourceState('linden_outlawalert') ~= 'started' then return end
Dispatch = Dispatch or {}
-75
View File
@@ -1,75 +0,0 @@
if GetResourceState('ps-dispatch') ~= 'started' then return end
Dispatch = {}
Dispatch.SendAlert = function(data)
local customData = {
message = data.message,
code = data.code or '10-80',
icon = data.icon or 'fas fa-question',
priority = data.priority or 2,
coords = data.coords or vec3(0.0, 0.0, 0.0),
gender = data.gender or nil,
camId = data.camId or nil,
color = data.firstColor or nil,
callsign = data.callsign or nil,
name = data.name or nil,
vehicle = data.model or nil,
plate = data.plate or nil,
alertTime = data.alertTime or nil,
doorCount = data.doorCount or nil,
automaticGunfire = data.automaticGunfire or false,
alert = {
radius = data.radius or 0,
recipientList = data.job or { 'leo' },
sprite = data.sprite or 1,
color = data.color or 1,
scale = data.scale or 0.5,
length = data.length or 2,
sound = data.sound or "Lose_1st",
sound2 = data.sound2 or "GTAO_FM_Events_Soundset",
offset = data.offset or false,
flash = data.flash or false
},
jobs = { data.job or 'leo' }
}
exports["ps-dispatch"]:CustomAlert(customData)
end
--[[
-- tested, it worked
CreateThread(function()
local data = {
message = "Fart",
code = '10-80',
icon = 'fas fa-question',
priority = 2,
coords = vec3(0.0, 0.0, 0.0),
gender = nil,
camId = nil,
color = nil,
callsign = nil,
name = "Test Name",
vehicle = nil,
plate = nil,
alertTime = 30000,
doorCount = nil,
automaticGunfire = false,
alert = {
radius = 0,
recipientList = { 'leo' },
sprite = 1,
color = 1,
scale = 0.5,
length = 2,
sound = "Lose_1st",
sound2 = "GTAO_FM_Events_Soundset",
offset = false,
flash = false
},
jobs = { 'leo' }
}
Dispatch.SendAlert(data)
Prints.Debug("Dispatched")
end)
--]]
@@ -0,0 +1,29 @@
if GetResourceState('ps-dispatch') ~= '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
@@ -0,0 +1,2 @@
if GetResourceState('ps-dispatch') ~= 'started' then return end
Dispatch = Dispatch or {}
-42
View File
@@ -1,42 +0,0 @@
if GetResourceState('qs-dispatch') ~= 'started' then return end
Dispatch = {}
Dispatch.SendAlert = function(data)
local playerData = exports['qs-dispatch']:GetPlayerInfo()
if not playerData then
print("Error getting player data")
return
end
local customData = {
job = data.job or { 'police', 'sheriff', 'traffic', 'patrol' }, -- Job Names
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 or "No message provided.",
flashes = data.flash or false,
image = data.image or nil,
blip = {
sprite = data.sprite or 1,
scale = data.scale or 1.0,
colour = data.color or 1,
flashes = data.flash or false,
text = data.blipText or "Alert",
time = data.length and (data.length * 1000) or 20000 -- Default to 20 seconds
},
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
@@ -0,0 +1,38 @@
if GetResourceState('qs-dispatch') ~= 'started' 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
@@ -0,0 +1,2 @@
if GetResourceState('qs-dispatch') ~= 'started' then return end
Dispatch = Dispatch or {}
@@ -1,16 +0,0 @@
if GetResourceState('rcore_dispatch') ~= 'started' then return end
Dispatch = {}
Dispatch.SendAlert = function(data)
local playerData = exports['rcore_dispatch']:GetPlayerData()
TriggerEvent('rcore_dispatch:server:sendAlert', {
code = data.code or '10-80',
default_priority = 'low',
coords = data.coords or playerData.coords,
job = data.job,
text = data.message or 'No message provided',
type = 'alerts',
blip = { sprite = 54, colour = 3, scale = 0.7, text = data.message or "No Message", flashes = false, radius = 0 }
})
end