From 5cc8a0cd68d470047739bc9a26b84e05a9860a5f Mon Sep 17 00:00:00 2001 From: Luke <62490330+Luke20201@users.noreply.github.com> Date: Sun, 19 Apr 2026 16:20:44 +0100 Subject: [PATCH 1/3] Add server SendAlert support for fd_dispatch --- .../dispatch/fd_dispatch/server/server.lua | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/modules/dispatch/fd_dispatch/server/server.lua b/modules/dispatch/fd_dispatch/server/server.lua index ef9fa8f..1e39097 100644 --- a/modules/dispatch/fd_dispatch/server/server.lua +++ b/modules/dispatch/fd_dispatch/server/server.lua @@ -8,4 +8,37 @@ Dispatch.GetResourceName = function() return 'fd_dispatch' end -return Dispatch \ No newline at end of file +Dispatch.SendAlert = function(data) + local metadata = {} + if data.vehicle then + table.insert(metadata, { + type = 'vehicle', + model = data.vehicle or locale('unknown_vehicle_model'), + plate = data.plate or nil, + color = data.colorHex or nil + }) + end + if type(data.job) == "string" then + data.job = {data.job} + end + local coords = data.coords or nil + 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 = { + radius = data.blip and data.blip.radius or 0, + sprite = data.blip and data.blip.sprite or 161, + color = data.blip and data.blip.color or 84, + scale = data.blip and data.blip.scale or 1.0, + time = data.time and (data.time / 1000) or nil, + }, + } + exports.fd_dispatch:addAlert(alertData) +end + +return Dispatch From b8642cea23e8cc10c30d16a7bb00cebdaa43da69 Mon Sep 17 00:00:00 2001 From: Luke <62490330+Luke20201@users.noreply.github.com> Date: Sun, 19 Apr 2026 17:10:57 +0100 Subject: [PATCH 2/3] Fix blips --- modules/dispatch/fd_dispatch/server/server.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/dispatch/fd_dispatch/server/server.lua b/modules/dispatch/fd_dispatch/server/server.lua index 1e39097..9a62eef 100644 --- a/modules/dispatch/fd_dispatch/server/server.lua +++ b/modules/dispatch/fd_dispatch/server/server.lua @@ -21,7 +21,7 @@ Dispatch.SendAlert = function(data) if type(data.job) == "string" then data.job = {data.job} end - local coords = data.coords or nil + local coords = data.coords or GetEntityCoords(GetPlayerPed(data.source)) local alertData = { source = data.source, title = data.title or "No message provided", @@ -31,11 +31,15 @@ Dispatch.SendAlert = function(data) priority = data.priority or 2, metadata = metadata, blip = { - radius = data.blip and data.blip.radius or 0, + title = data.title or "No message provided", + coords = coords, + radius = data.blip and data.blip.radius or nil, sprite = data.blip and data.blip.sprite or 161, - color = data.blip and data.blip.color or 84, - scale = data.blip and data.blip.scale or 1.0, - time = data.time and (data.time / 1000) or nil, + 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, }, } exports.fd_dispatch:addAlert(alertData) From 14779773ac38102f72a4b9bcdc3109eea65c36b2 Mon Sep 17 00:00:00 2001 From: Luke <62490330+Luke20201@users.noreply.github.com> Date: Sun, 19 Apr 2026 17:20:19 +0100 Subject: [PATCH 3/3] ox_target cleanup when invoking resource is stopped --- modules/target/ox_target/client.lua | 37 +++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index 45ffd85..04100bf 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -7,6 +7,11 @@ local targetDebug = BridgeSharedConfig and BridgeSharedConfig.DebugLevel == 2 or local ox_target = exports.ox_target local targetZones = {} +local resourceTargets = {} +resourceTargets.models = {} +resourceTargets.entities = {} +resourceTargets.networkedEntities = {} + Target.GetResourceName = function() return "ox_target" end @@ -99,6 +104,9 @@ end function Target.AddLocalEntity(entities, options) options = Target.FixOptions(options) ox_target:addLocalEntity(entities, options) + local resource = GetInvokingResource() + resourceTargets.entities[resource] = resourceTargets.entities[resource] or {} + table.insert(resourceTargets.entities[resource], { entities = entities}) end ---This will remove the target options from a local entity. This is useful for when you want to remove target options from a specific entity. @@ -114,6 +122,9 @@ end function Target.AddNetworkedEntity(netids, options) options = Target.FixOptions(options) ox_target:addEntity(netids, options) + local resource = GetInvokingResource() + resourceTargets.networkedEntities[resource] = resourceTargets.networkedEntities[resource] or {} + table.insert(resourceTargets.networkedEntities[resource], { netids = netids}) end ---This will remove a networked entity from the target system. @@ -129,6 +140,9 @@ end function Target.AddModel(models, options) options = Target.FixOptions(options) ox_target:addModel(models, options) + local resource = GetInvokingResource() + resourceTargets.models[resource] = resourceTargets.models[resource] or {} + table.insert(resourceTargets.models[resource], { models = models}) end ---This will remove target options from all specified models. @@ -189,13 +203,32 @@ function Target.RemoveZone(name) end AddEventHandler('onResourceStop', function(resource) - if resource ~= GetCurrentResourceName() then return end for _, target in pairs(targetZones) do if target.creator == resource then ox_target:removeZone(target.id) end end targetZones = {} + if resourceTargets.entities[resource] and #resourceTargets.entities[resource] > 0 then + for _, data in pairs(resourceTargets.entities[resource]) do + Target.RemoveLocalEntity(data.entities) + end + end + resourceTargets.entities[resource] = nil + if resourceTargets.networkedEntities[resource] and #resourceTargets.networkedEntities[resource] > 0 then + for _, data in pairs(resourceTargets.networkedEntities[resource]) do + Target.RemoveNetworkedEntity(data.netids) + end + end + resourceTargets.networkedEntities[resource] = nil + if resourceTargets.models[resource] and #resourceTargets.models[resource] > 0 then + for _, data in pairs(resourceTargets.models[resource]) do + for _, model in pairs(data.models) do + ox_target:removeModel(model) + end + end + end + resourceTargets.models[resource] = nil end) -return Target \ No newline at end of file +return Target