Cannot change radio station
#1

Hello,
sometimes I (and my community) have the bug that I cannot change the gta sa radio station after PlayAudioStreamForPlayer. (But the stream has stopped and StopAudioStreamForPlayer doesn't fix it!!)
There is also the bug that you hear unlimited times the radio switching sound after the audio stream.

Thats very annoying because you have to restart your game.

greets
Reply
#2

Confirmed in 0.3d, but you don't need to restart your game. Leave and enter your vehicle again fixes the problem.
You can use a timer to put the player out of their vehicles and put them back after using PlayAudioStreamForPlayer for them.
Reply
#3

Confirmed 0.3e and 0.3d

Wish we had radio enabling functions o.o
Reply
#4

Just stop the stream and play sound 1068 then a few seconds later play 1069, this re-activates the radio while driving a vehicle (tested)

pawn Код:
}
forward ResetAllPlayersRadio();
public ResetAllPlayersRadio()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            PlayerPlaySound(i, 1068, 0.0, 0.0, 0.0);
            SetTimerEx("EnablePlayerRadio",2000,false,"i",i);
        }
    }
    return 1;
}
forward EnablePlayerRadio(playerid);
public EnablePlayerRadio(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
    }
    return 1;
}
with this just make a command to call "ResetAllPlayersRadio();" or put it in a stopaudiostream function.

Hope this helps
Reply
#5

@Above
you're using forward, to create public functions...
For the "ResetAllPlayersRadio(); You should use stock.
Reply
#6

Oh don't talk sh!t...you can do it either way it really doesn't matter, 'stock' or 'public' it will work just the same.
You don't even have to have it like this it was just an example...

nobody else has posted a solution to this problem, not even you with your superior intelligence and knowledge..
Reply
#7

Thank you, but a real bugfix in SA:MP would be better than 100 timers server side.
Reply
#8

Yeah no problem, as i said before it was just an small example.

You could change the code an just call it for the players needed, or even call it from a global one second timer for players that have just had an audio stream stopped for them as i do myself...

pawn Код:
//at the top
new PlayerRadioReset[MAX_PLAYERS];

//under onplayerconnect
PlayerRadioReset[playerid] = 0;

//inside a global one second timer that has a max player loop
if(PlayerRadioReset[i] >= 1)
{
    if(PlayerRadioReset[i] == 1)
    {
        PlayerPlaySound(i, 1068, 0.0, 0.0, 0.0);
    }
    PlayerRadioReset[i] += 1;
    if(PlayerRadioReset[i] >= 4)
    {
        PlayerPlaySound(i, 1069, 0.0, 0.0, 0.0);
        PlayerRadioReset[i] = 0;
    }
}

//under any "StopAudioStreamForPlayer(playerid);" just add...
PlayerRadioReset[playerid] = 1;

Even if it was integrated into the sa:mp client i still think it would require the two second delay, because just playing the two sounds one straight after the other like this...

pawn Код:
PlayerPlaySound(playerid, 1068, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1069, 0.0, 0.0, 0.0);
Has absolutely no effect and doesn't fix your radio, i tested this and two seconds was as low as i could go to get "everyones" radio fixed "everytime" without any fails.


Edit: Just noticed that the two second delay fails for some players so i went up to a three second delay an all seems fine now, and another thing is this can make your client crash sometimes...so mabe its not such a good solution after all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)