From 953fd9ebd9d4e2e1602ef358dce6e6933d5e8080 Mon Sep 17 00:00:00 2001 From: Trapson <78444706+ItsTrapson@users.noreply.github.com> Date: Sat, 17 Aug 2024 05:15:11 +0100 Subject: [PATCH 1/4] Update alerts.lua --- client/alerts.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/alerts.lua b/client/alerts.lua index b394083..21f5edb 100644 --- a/client/alerts.lua +++ b/client/alerts.lua @@ -596,10 +596,20 @@ end --- @param data string -- Message --- @param type string -- What type of emergency --- @param anonymous boolean -- Is the call anonymous +local pslastaction = 0 RegisterNetEvent('ps-dispatch:client:sendEmergencyMsg', function(data, type, anonymous) + local year, month , day , hour, minute, second = GetUtcTime() + local idtrack = tonumber(hour..minute..second) + local spamdetek = idtrack - pslastaction + if spamdetek < 0 then spamdetek = Config.AlartCommandCooldown end + if spamdetek <= Config.AlartCommandCooldown and pslastaction > 0 then + pslastaction = idtrack + QBCore.Functions.Notify("Command on cooldown", "error") + else + pslastaction = idtrack local jobs = { ['911'] = { 'leo' }, ['311'] = { 'ems' } } - PhoneCall(data, anonymous, jobs[type], type) + end end) From 239f4acf0083190c7b8c16ffc14e5ba0a4fecad9 Mon Sep 17 00:00:00 2001 From: Trapson <78444706+ItsTrapson@users.noreply.github.com> Date: Sat, 17 Aug 2024 05:15:45 +0100 Subject: [PATCH 2/4] Update config.lua --- shared/config.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared/config.lua b/shared/config.lua index 4d41449..9b5a094 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -14,6 +14,8 @@ Config.Jobs = { -- Job Types or names that can access the dispatch menu. If you "ems" } +Config.AlartCommandCooldown = 60 -- this would make the command work every 60 seconds to avoid spamming + Config.DefaultAlertsDelay = 5 -- Delay between each default alert, prevent spamming Config.DefaultAlerts = { Speeding = true, From 5804586b379dbfc45e00e369130d34744b98364d Mon Sep 17 00:00:00 2001 From: Trapson <78444706+ItsTrapson@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:54:28 +0100 Subject: [PATCH 3/4] Update config.lua --- shared/config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/config.lua b/shared/config.lua index 9b5a094..2554c75 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -14,7 +14,7 @@ Config.Jobs = { -- Job Types or names that can access the dispatch menu. If you "ems" } -Config.AlartCommandCooldown = 60 -- this would make the command work every 60 seconds to avoid spamming +Config.AlertCommandCooldown = 60 -- this would make the command work every 60 seconds to avoid spamming Config.DefaultAlertsDelay = 5 -- Delay between each default alert, prevent spamming Config.DefaultAlerts = { From 2763c1cb0aaadbdba4627c23b3b43db38cab303f Mon Sep 17 00:00:00 2001 From: Trapson <78444706+ItsTrapson@users.noreply.github.com> Date: Tue, 17 Sep 2024 04:55:12 +0100 Subject: [PATCH 4/4] Update alerts.lua --- client/alerts.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/alerts.lua b/client/alerts.lua index 21f5edb..2993ca2 100644 --- a/client/alerts.lua +++ b/client/alerts.lua @@ -601,8 +601,8 @@ RegisterNetEvent('ps-dispatch:client:sendEmergencyMsg', function(data, type, ano local year, month , day , hour, minute, second = GetUtcTime() local idtrack = tonumber(hour..minute..second) local spamdetek = idtrack - pslastaction - if spamdetek < 0 then spamdetek = Config.AlartCommandCooldown end - if spamdetek <= Config.AlartCommandCooldown and pslastaction > 0 then + if spamdetek < 0 then spamdetek = Config.AlertCommandCooldown end + if spamdetek <= Config.AlertCommandCooldown and pslastaction > 0 then pslastaction = idtrack QBCore.Functions.Notify("Command on cooldown", "error") else