Possible to Loop "AudioStreamForPlayer" ?
#2

pawn Code:
// top of script
new RandomMusic[][] =
{
    "URL1",
    "URL2",
    "URL3"
};
// ongamemodeinit
SetTimer("SwitchNewSound", 60000*3, true); // 3 minutes
// somewhere in your script
forward SwitchNewSound();
public SwitchNewSound()
{
    new randURL = random(sizeof(RandomMusic));
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
        if(IsPlayerConnected(playerid))
        {
            StopAudioStreamForPlayer(playerid);
            PlayAudioStreamForPlayer(playerid, RandomMusic[randURL]);
        }
    }
    return 1;
}
I set the timer to 3 minutes, but if you wan't to start a new sound only if the old sound is done, I have no idea
Reply


Messages In This Thread
Possible to Loop "AudioStreamForPlayer" ? - by denNorske - 18.10.2012, 12:15
Re: Possible to Loop "AudioStreamForPlayer" ? - by Roel - 18.10.2012, 12:20
Re: Possible to Loop "AudioStreamForPlayer" ? - by denNorske - 18.10.2012, 12:32
Re: Possible to Loop "AudioStreamForPlayer" ? - by Roel - 18.10.2012, 12:36
Re: Possible to Loop "AudioStreamForPlayer" ? - by denNorske - 18.10.2012, 12:40
Re: Possible to Loop "AudioStreamForPlayer" ? - by Roel - 18.10.2012, 12:43

Forum Jump:


Users browsing this thread: 2 Guest(s)