Skip to content

setRadioChannel doesn't work when outside a vehicle #423

Open

Description

@ArranTuna

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:

srun for ,v in ipairs(getElementsByType("player")) do spawnPlayer(v, 0, 0, 3) setCameraTarget(v, v) fadeCamera(v, true, 0) end
crun setRadioChannel(1)
srun vehicle = createVehicle(410, 5, 0, 3) for ,v in ipairs(getElementsByType("player")) do warpPedIntoVehicle(v, vehicle) end setTimer(destroyElement, 500, 1, vehicle)
crun setRadioChannel(1)

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

Additional context
https://bugs.mtasa.com/view.php?id=8908

Activity

  1. self-assigned this
    on Sep 6, 2018
  2. added this to the 1.5.7 milestone on Sep 6, 2018
  3. modified the milestones: 1.5.7, Backlog on Nov 3, 2018
  4. removed their assignment
    on Apr 13, 2020
  5. lopezloo commented on Sep 14, 2021

    @lopezloo
    Member

    Another workaround for this is teleporting player into audio zone for a moment:

    run me.position=Vector3(-1392.701, 989.287, 1025) setTimer(function() me.position=Vector3(0, 0, 5) end, 100, 1)
    crun setRadioChannel(1) -- works
    

    Doesn't require creating vehicle.

  6. lopezloo commented on Sep 14, 2021

    @lopezloo
    Member

    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.

  7. self-assigned this
    on Sep 14, 2021
  8. removed their assignment
    on Oct 2, 2021
  9. added a commit that references this issue on Jul 31, 2026
    2c0a0a5
  10. added a commit that references this issue on Sep 7, 2026
    b0586f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions