Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Don't let players spam the distress signal
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat authored May 8, 2021
1 parent 0ce1535 commit 88c05ba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ Citizen.CreateThread(function()
end
end)

local canSendSignal = true
RegisterCommand('alert_dead', function()
if playerIsDead then
if playerIsDead and canSendDistress then
canSendDistress = false
local netId = NetworkGetNetworkIdFromEntity(playerPed)
local name = ('%s %s'):format(firstname, lastname)
local title = ('%s %s'):format(rank, lastname)
Expand All @@ -296,17 +298,20 @@ RegisterCommand('alert_dead', function()
Citizen.Wait(2000)
data = {dispatchCode = 'officerdown', caller = name, coords = playerCoords, netId = netId, info = title, length = 10000}
TriggerServerEvent('wf-alerts:svNotify', data)
Citizen.Wait(20000)
canSendDistress = true
elseif Config.Enable.PlayerDowned then
Citizen.Wait(2000)
data = {dispatchCode = 'persondown', _U('caller_local'), coords = playerCoords, netId = netId, length = 8000}
TriggerServerEvent('wf-alerts:svNotify', data)
Citizen.Wait(20000)
canSendDistress = true
end
end
end, false)

RegisterKeyMapping('alert_dead', 'Send distress signal to Police/EMS', 'keyboard', 'G')


RegisterCommand('911', function(playerId, args, rawCommand)
if not args[1] then exports['mythic_notify']:SendAlert('error', 'You must include a message with your 911 call') return end
args = table.concat(args, ' ')
Expand Down

0 comments on commit 88c05ba

Please sign in to comment.