[snippet] pma-voice (talk to walkie talkie prop)

A snippet for pma-voice that makes you talk on a walkie talkie prop instead of “cb radio”.

HOW TO INSTALL :

Go to pma-voice > client > module > radio.lua

Replace RegisterCommand(‘+radiotalk’, function() with :

RegisterCommand('+radiotalk', function()
	if GetConvarInt('voice_enableRadios', 1) ~= 1 then return end
	if isDead() or LocalPlayer.state.disableRadio then return end

	if not radioPressed and radioEnabled then
		if radioChannel > 0 then
			logger.info('[radio] Start broadcasting, update targets and notify server.')
			playerTargets(radioData, 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('ultra@walkie_talkie')
				while not HasAnimDictLoaded('ultra@walkie_talkie') do
					Wait(10)
				end
				TaskPlayAnim(PlayerPedId(), "ultra@walkie_talkie", "walkie_talkie", 8.0, 2.0, -1, 50, 2.0, false, false, false)
				radioProp = CreateObject(`prop_cs_hand_radio`, 1.0, 1.0, 1.0, 1, 1, 0)
				AttachEntityToEntity(radioProp, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 18905), 0.13, 0.02, 0.02, 270.0, 50.0, -5.0, 1, 0, 0, 0, 2, 1)
			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)

Replace RegisterCommand(‘-radiotalk’, function() with :

RegisterCommand('-radiotalk', function()
	if (radioChannel > 0 or radioEnabled) and radioPressed then
		radioPressed = false
		MumbleClearVoiceTargetPlayers(voiceTarget)
		playerTargets(MumbleIsPlayerTalking(PlayerId()) and callData or {})
		TriggerEvent("pma-voice:radioActive", false)
		playMicClicks(false)
		if GetConvarInt('voice_enableRadioAnim', 0) == 1 then
			StopAnimTask(PlayerPedId(), "ultra@walkie_talkie", "walkie_talkie", 1.0)
			ClearPedTasks(PlayerPedId())
			if radioProp ~= 0 then
				DeleteObject(radioProp)
				radioProp = 0
			end
		end
		TriggerServerEvent('pma-voice:setTalkingOnRadio', false)
	end
end, false)

enjoy!

ps : you need scully-emotes

if you have questions or problems you can visit : SUPPORT :orange_book:

7 Likes

Please just use pma-voice:radioActive instead and don’t overwrite underlying code.

Also you shouldn’t need to ClearPedTasks if you’re using StopAnimTask

1 Like

Its the default code nothing is underlying changed or what so ever, only the animation and prop are changed witch are there by default.

This still doesn’t change the fact that you can use events to override this instead of modifying resource code.

1 Like

sure, this is just a quick, easy and dirty way to do it, if anyone wants he can always change it to use an event :person_shrugging:

1 Like

dam thx ! fire snippet :fire:

1 Like

Not a release