Voice and radio

The resource uses a modified version of pma-voice that is REQUIRED to integrate the global radio and the units radio.

You can find this modified version in this Download Link

What changes?

The changes do not affect the functionality of the resource and only include new features like:

RegisterCommand('+radioglobaltalk', function()
	if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end
	if isDead() or LocalPlayer.state.disableRadio then return end
	if not LocalPlayer.state['radio_allowed'] then return end
	if not LocalPlayer.state['global_radio'] then return end
	if not radioPressed and radioEnabled then
		if radioChannel > 0 then
			logger.info('[radio] Start broadcasting, update targets and notify server.')
			playerTargets(LocalPlayer.state['global_radio'] or {}, MumbleIsPlayerTalking(PlayerId()) and callData or {})
			TriggerServerEvent('pma-voice:setTalkingOnRadio', true)
			radioPressed = true
			playMicClicks(true)
			if GetConvarInt('voice_enableRadioAnim', 0) == 1 and not (GetConvarInt('voice_disableVehicleRadioAnim', 0) == 1 and IsPedInAnyVehicle(PlayerPedId(), false)) and not disableRadioAnim then
				RequestAnimDict('random@arrests')
				while not HasAnimDictLoaded('random@arrests') do
					Wait(10)
				end
				TaskPlayAnim(PlayerPedId(), "random@arrests", "generic_radio_enter", 8.0, 2.0, -1, 50, 2.0, false, false,
					false)
			end
			CreateThread(function()
				TriggerEvent("pma-voice:radioActive", true)
				while radioPressed and not LocalPlayer.state.disableRadio do
					Wait(0)
					SetControlNormal(0, 249, 1.0)
					SetControlNormal(1, 249, 1.0)
					SetControlNormal(2, 249, 1.0)
				end
			end)
		end
	end
end, false)

RegisterNetEvent('rcore_dispatch:client:sendBlacklistChannels', function(data)
	for _, val in pairs(data) do
		for _, channel in pairs(val.Units) do
			channelsDisabled[tonumber(channel[2])] = true
		end
	end
end)

This is the main modification, the global radio. Using the exports the resource sets the radio channel of the user. The important modification is this global radio feature which is required to work with the global radio system. Also, the resource includes a system to only allow dispatch users to access to specific radio channels.

If you need to review all the changes to addapt the system to your custom voice system, you can do it here

Last updated