[Standalone] [Release] Radio Panic Button [rp-radio]

radioPanicButton

Radio Panic Button

This script is easy to setup and is fully configurable.
This is my first release so feedback is appreciated. :slight_smile:

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 
    },
}

 

Showcase

Video:


If video doesn’t work.

Screenshots:

image

 

How to Install (mumble-voip)
  1. Download the latest release
  2. Rename the resource to just “radioPanicButton”
  3. Configure the config.lua file
  4. Add to your server.cfg ensure radioPanicButton
  5. Setup ace permissions (more info in config file)

 

How to Install (pma-voice)
  1. Download the latest release
  2. Rename the resource to just “radioPanicButton”
  3. Configure the config.lua file
  4. Add to your server.cfg ensure radioPanicButton
  5. Setup ace permissions (more info in config file)
  6. In the config.lua file set usePmaVoice = true
  7. 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)

 

Github | Download

14 Likes

looks amazing! :clap:

1 Like

mumble voip is no longer being supported and is broken for many servers so I would make this compatible with pma-voice.

2 Likes

Ye, I am going to add support for pma-voice soon but there will be one additional step of adding some code to pma-voice since pma-voice doesn’t have the same exports as mumble-voip.

1 Like

Ya, I am going to add support for pma-voice soon but there will be one additional step of adding some code to pma-voice since pma-voice doesn’t have the same exports as mumble-voip.

Awesome! I’ll bookmark this and keep an eye on when that gets done. Nice release bud!

It doesn’t have the same exports but it is very similar and I believe in the documentation for pma-voice there are a few functions or exports from mumble-voip that are carried over to pma-voice. I could be wrong, I haven’t looked at it since I installed it in my city.

1 Like

Correct, there are a few I personally use pma-voice on my FiveM server and prefer it over mumble. I will try to get the support for pma added by tomorrow.

1 Like

pma-voice isn’t much better, same issues as mumble-voip.

Negative, had yet to have a problem. User error is what most people are having.

Same as @LlamaPalooza, I haven’t experienced any issues with pma-voice.

I love it great work!
Keep it up!

1 Like

@LlamaPalooza I have finished the pma-voice implementation. I just need to test it tonight and it should be released.

1 Like

AWESOME! Thanks.

@Aidan_ogg
Also, I use another radio, sm-radio, a paid resource so I would have to edit this resource to work with it, that shouldn’t be too hard would it? It’s very similar so I think I should be easy.

If it makes it any easier, the latest version has a getter for radio channels

1 Like

Thanks, this will make it a lot easier.

Script now supports pma-voice, read the installation tutorial for more info.

1 Like

everytime i press the panic button it says in chat RadioPanicButton is not a valid command but it is logging to the discord fine?

1 Like

By any chance on line 3 did you change the name of the keymapping and on line 4 the name of the command?

the only thing i changed was logs to discord and what channel the panic was supposed to be broadcasted in

Can you send me your config file?