Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion client/alerts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.AlertCommandCooldown end
if spamdetek <= Config.AlertCommandCooldown 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)


Expand Down
2 changes: 2 additions & 0 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Config.Jobs = { -- Job Types or names that can access the dispatch menu. If you
"ems"
}

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 = {
Speeding = true,
Expand Down