Radio Panic Button
This script is easy to setup and is fully configurable.
This is my first release so feedback is appreciated.
Features:
- Panic Button Audio
- Dispatch Audio (similar to LSPDFR)
- Only broadcasts audio, blips, and notifications to people in specified radio channels
- Discord logging
- Blip for panic button
- Notification for panic button
- Each client can customize their keybind
- Fully customizable
- Supports mumble-voip and pma-voice
To be Added:
Support for pma-voice (ETA: 27/05/2021)- Support for ESX (Unknown)
Requirements
Example Config
config = {
usePmaVoice = false, -- If set to true it will use pma-voice, if set to false it will use mumble-voip
acePermissionName = 'panicButton', -- Example for config: add_ace group.leo panicButton allow [For Blips and Notification]
logToDiscord = false, -- Logs panic button presses to Discord
useDiscordNameForLog = true, -- If set to true it will put the user's @ instead of their in game name, unless they don't have a Discord account linked
discordWebhookUrl = '', -- Webhook to log panic button presses to
playPanicButtonAudio = true, -- Plays a beeping noise when you hit the panic button
playDispatchAudio = true, -- Plays the dispatch audio (We have a 10-99...)
panicButtonVolume = 0.8, -- Panic button and dispatch audio volume
showBlip = true, -- Shows a blip of the officer's location
blipsInBroadcastChannels = true, -- Will only show blips to the people in the channels specified in the broadcastChannels table below
blipTimeout = 60, -- Amount of time before the panic button blip gets deleted (in seconds)
showNotification = true, -- Shows a notification saying "[playerName] pressed their panic button at [streetName]"
notificationsInBroadcastChannels = true, -- Will only show notifications to the people in the channels specified in the broadcastChannels table below
haveRadioOpen = true, -- Makes it so you have to have your radio open to hit the panic button
panicButtonKey = 'n', -- This will be the original key for the panic button, each client can further customise the keybind inn their GTA V keybinds menu under the FiveM tab
radioChannels = {
[1] = 1, -- Allows the panic button to be used in frequency 1
[2] = 2, -- Allows the panic button to be used in frequency 1
[3] = 3, -- Allows the panic button to be used in frequency 1
},
broadcastChannels = {
[1] = 1, -- Broadcasts the panic button to frequency 1
[2] = 2, -- Broadcasts the panic button to frequency 1
},
}
How to Install (mumble-voip)
- Download the latest release
- Rename the resource to just “radioPanicButton”
- Configure the config.lua file
- Add to your server.cfg
ensure radioPanicButton
- Setup ace permissions (more info in config file)
How to Install (pma-voice)
- Download the latest release
- Rename the resource to just “radioPanicButton”
- Configure the config.lua file
- Add to your server.cfg
ensure radioPanicButton
- Setup ace permissions (more info in config file)
- In the config.lua file set
usePmaVoice = true
- Add the following code below to pma-voice
server/server.lua
function getPlayersInRadioChannel(channel)
local returnChannel = radioData[channel]
if returnChannel then
return returnChannel
end
-- channel doesnt exist
return {}
end
function getPlayersInRadioChannels(...)
local channels = { ... }
local players = {}
for i = 1, #channels do
local channel = tonumber(channels[i])
if channel ~= nil then
if radioData[channel] ~= nil then
players[#players + 1] = radioData[channel]
end
end
end
return players
end
exports('getPlayersInRadioChannel', getPlayersInRadioChannel)
exports('GetPlayersInRadioChannel', getPlayersInRadioChannel)
exports('GetPlayersInRadioChannels', getPlayersInRadioChannels)
exports('GetPlayersInRadioChannels', getPlayersInRadioChannels)
client/client.lua
function GetPlayersInRadioChannels(...)
local channels = { ... }
local players = {}
for i = 1, #channels do
local channel = tonumber(channels[i])
if channel ~= nil then
if radioData[channel] ~= nil then
players[#players + 1] = radioData[channel]
end
end
end
return players
end
function GetPlayerRadioChannel(serverId)
if serverId ~= nil then
if voiceData.radio > 0 then
return voiceData.radio
end
end
end
exports("GetPlayersInRadioChannels", GetPlayersInRadioChannels)
exports("GetPlayerRadioChannel", GetPlayerRadioChannel)