33--- @param radioTable table the table of the current players on the radio
44function syncRadioData (radioTable )
55 radioData = radioTable
6- debug . log ((' [radio] Syncing radio table.' ))
6+ logger . info ((' [radio] Syncing radio table.' ))
77 if GetConvarInt (' voice_debugMode' , 0 ) >= 4 then
88 print (' -------- RADIO TABLE --------' )
99 tPrint (radioData )
@@ -34,10 +34,10 @@ RegisterNetEvent('pma-voice:setTalkingOnRadio', setTalkingOnRadio)
3434function addPlayerToRadio (plySource )
3535 radioData [plySource ] = false
3636 if radioPressed then
37- debug . log ((' [radio] %s joined radio %s while we were talking, adding them to targets' ):format (plySource , radioChannel ))
37+ logger . info ((' [radio] %s joined radio %s while we were talking, adding them to targets' ):format (plySource , radioChannel ))
3838 playerTargets (radioData , NetworkIsPlayerTalking (PlayerId ()) and callData or {})
3939 else
40- debug . log ((' [radio] %s joined radio %s' ):format (plySource , radioChannel ))
40+ logger . info ((' [radio] %s joined radio %s' ):format (plySource , radioChannel ))
4141 end
4242end
4343RegisterNetEvent (' pma-voice:addPlayerToRadio' , addPlayerToRadio )
@@ -47,24 +47,23 @@ RegisterNetEvent('pma-voice:addPlayerToRadio', addPlayerToRadio)
4747--- @param plySource number the players server id to remove from the radio.
4848function removePlayerFromRadio (plySource )
4949 if plySource == playerServerId then
50- debug . log ((' [radio] Left radio %s, cleaning up.' ):format (radioChannel ))
50+ logger . info ((' [radio] Left radio %s, cleaning up.' ):format (radioChannel ))
5151 for tgt , enabled in pairs (radioData ) do
5252 if tgt ~= playerServerId then
5353 toggleVoice (tgt , false )
5454 end
5555 end
5656 radioData = {}
57- playerTargets ({}, NetworkIsPlayerTalking (PlayerId ()) and callData or {})
57+ playerTargets (NetworkIsPlayerTalking (PlayerId ()) and callData or {})
5858 else
5959 radioData [plySource ] = nil
6060 toggleVoice (plySource , false )
6161 if radioPressed then
62- debug . log ((' [radio] %s left radio %s while we were talking, updating targets.' ):format (plySource , radioChannel ))
62+ logger . info ((' [radio] %s left radio %s while we were talking, updating targets.' ):format (plySource , radioChannel ))
6363 playerTargets (radioData , NetworkIsPlayerTalking (PlayerId ()) and callData or {})
6464 else
65- debug . log ((' [radio] %s has left radio %s' ):format (plySource , radioChannel ))
65+ logger . info ((' [radio] %s has left radio %s' ):format (plySource , radioChannel ))
6666 end
67-
6867 end
6968end
7069RegisterNetEvent (' pma-voice:removePlayerFromRadio' , removePlayerFromRadio )
@@ -126,7 +125,7 @@ RegisterCommand('+radiotalk', function()
126125
127126 if not radioPressed and radioEnabled then
128127 if radioChannel > 0 then
129- debug . log ((' [radio] Start broadcasting, update targets and notify server.' ))
128+ logger . info ((' [radio] Start broadcasting, update targets and notify server.' ))
130129 playerTargets (radioData , NetworkIsPlayerTalking (PlayerId ()) and callData or {})
131130 TriggerServerEvent (' pma-voice:setTalkingOnRadio' , true )
132131 radioPressed = true
@@ -148,6 +147,7 @@ RegisterCommand('-radiotalk', function()
148147 if radioChannel > 0 or radioEnabled then
149148 radioPressed = false
150149 MumbleClearVoiceTargetPlayers (1 )
150+ playerTargets (NetworkIsPlayerTalking (PlayerId ()) and callData or {})
151151 TriggerEvent (" pma-voice:radioActive" , false )
152152 playMicClicks (false )
153153 TriggerServerEvent (' pma-voice:setTalkingOnRadio' , false )
@@ -160,7 +160,7 @@ RegisterKeyMapping('+radiotalk', 'Talk over Radio', 'keyboard', GetConvar('voice
160160--- @param _radioChannel number the radio channel to set the player to.
161161function syncRadio (_radioChannel )
162162 if GetConvarInt (' voice_enableRadios' , 1 ) ~= 1 then return end
163- debug . log ((' [radio] radio set serverside update to radio %s' ):format (radioChannel ))
163+ logger . info ((' [radio] radio set serverside update to radio %s' ):format (radioChannel ))
164164 radioChannel = _radioChannel
165165end
166166RegisterNetEvent (' pma-voice:clSetPlayerRadio' , syncRadio )
0 commit comments