From fd28d9a1a617b8dadfe631b0ae14ecf153d9bbe8 Mon Sep 17 00:00:00 2001 From: MrNewb <47620135+MrNewb@users.noreply.github.com> Date: Mon, 18 Aug 2025 02:18:52 -0400 Subject: [PATCH] attempt to add piotreq_gpt (dispatch compatability) --- .../dispatch/piotreq_gpt/client/client.lua | 10 +++++ .../dispatch/piotreq_gpt/server/server.lua | 39 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 modules/dispatch/piotreq_gpt/client/client.lua create mode 100644 modules/dispatch/piotreq_gpt/server/server.lua diff --git a/modules/dispatch/piotreq_gpt/client/client.lua b/modules/dispatch/piotreq_gpt/client/client.lua new file mode 100644 index 0000000..c0bc509 --- /dev/null +++ b/modules/dispatch/piotreq_gpt/client/client.lua @@ -0,0 +1,10 @@ +---@diagnostic disable: duplicate-set-field +if GetResourceState('piotreq_gpt') == 'missing' then return end +Dispatch = Dispatch or {} + +Dispatch.SendAlert = function(data) + if not data then return end + TriggerServerEvent('community_bridge:Server:piotreq_gpt', data) +end + +return Dispatch \ No newline at end of file diff --git a/modules/dispatch/piotreq_gpt/server/server.lua b/modules/dispatch/piotreq_gpt/server/server.lua new file mode 100644 index 0000000..a960eb0 --- /dev/null +++ b/modules/dispatch/piotreq_gpt/server/server.lua @@ -0,0 +1,39 @@ +if GetResourceState('piotreq_gpt') == 'missing' then return end +Dispatch = Dispatch or {} + +Dispatch.SendAlert = function(src, alertData) + -- No clue if this works, but itd be nice to have someone test it. + --https://piotreq-scripts.gitbook.io/piotreq-scripts/assets-and-guides/police-mdt/dispatch-system + exports['piotreq_gpt']:SendAlert(src, { + title = alertData.message or "No message provided", + code = alertData.code or '10-80', + icon = alertData.icon or 'fas fa-question', + info = { + {icon = alertData.icon or 'fas fa-question', data = alertData.message or "No additional info", isStreet = false}, + }, + --jobs = alertData.jobs or "police", + blip = { -- optional + scale = alertData.blipData and alertData.blipData.scale or 1.0, + sprite = alertData.blipData and alertData.blipData.sprite or 161, + category = 1, -- default 1 + color = alertData.blipData and alertData.blipData.color or 84, + hidden = false, -- default false (hidden on legend) + priority = alertData.priority or 5, -- default 5 + short = true, -- as short range? default true + alpha = 200, -- default 255 + name = alertData.message or "Dispatch Alert" + }, + type = 'normal', -- default normal + canAnswer = true, -- default false + maxOfficers = 6, -- default 4 + time = 10,-- 10 minutes, default 5 + notifyTime = 8000, -- 8 seconds, default 7 + }) +end + +RegisterNetEvent('community_bridge:Server:piotreq_gpt', function(data) + local src = source + Dispatch.SendAlert(src, data) +end) + +return Dispatch \ No newline at end of file