You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
setRadioChannel doesn't work when outside a vehicle #423
Describe the bug
Whenever you do setRadioChannel on a client while not in a vehicle, the radio channel will not be set - instead, will go to the station for less than a second and roll back to 0.
This is however fixed when the player enters the vehicle and radio gets on, and then exits, setRadioChannel works again. But without entering a vehicle it just simply flashes to the channel and resets to 0.
Apparently fixable by setting setRadioChannel( 0 ) to the beginning of the script, yet this does not work. I even tried everything with multiple timers and different techniques like this but none of which worked.
To Reproduce
Enter your server
Spawn the player
crun setRadioChannel(1)
Doesn't work.
Enter a vehicle (and make sure radio gets on).
Exit the vehicle.
crun setRadioChannel(1)
Works.
Additionally you could use these to test it out easily:
Note, that this happens sometimes. I was no longer able to reproduce this once I had the radio working and reconnected or restarted the server. But once I restarted my client and the server, this problem appeared again.
I was also able to hear radio just about 100 ms when I reconnected to the server while having the radio on. So it seems MTA isn't resetting the radio value (properly), and for some reason sets it incorrectly as well.
Client and server both at Multi Theft Auto v1.4.1-release-7312.
Running no other scripts other than runcode.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
MTA Client (please complete the following information):
Multi Theft Auto v1.5.6-release-16191
MTA Server (please complete the following information):
n/a
Ok. I have proper fix. Waiting for #2354 to be merged first.
edit:
... or maybe not
Changing 0x8AC164 (CAEAmbienceTrackManager.playState) to 3 after starting radio re-enables radio but it works only after some time after station was set. It doesn't do anything after setting this immedietly by MTA.
Activity
lopezloo commentedon Sep 14, 2021
Another workaround for this is teleporting player into audio zone for a moment:
Doesn't require creating vehicle.
lopezloo commentedon Sep 14, 2021
Ok. I have proper fix. Waiting for #2354 to be merged first.
edit:
... or maybe not
Changing 0x8AC164 (CAEAmbienceTrackManager.playState) to 3 after starting radio re-enables radio but it works only after some time after station was set. It doesn't do anything after setting this immedietly by MTA.
Fix client setRadioChannel breaking after reconnect
Fix setRadioChannel going silent on foot
Reset audio-zone dedup cache on connect