StreamAudioForPlayer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: StreamAudioForPlayer (
/showthread.php?tid=418792)
StreamAudioForPlayer -
Ananisiki - 26.02.2013
^^^^^^^^
Respuesta: StreamAudioForPlayer -
Strier - 26.02.2013
pawn Код:
// top of script
new RandomMusic[][] =
{
"http://listen.di.fm/public3/progressive.pls ",
"http://listen.di.fm/public3/eurodance.pls ",
"http://listen.di.fm/public3/house.pls "
};
// OnGameModeInIt
SetTimer("SwitchRadio", 60000*15, true); // meaning it will change every 15 minutes.
// somewhere in your script
forward SwitchRadio();
public SwitchRadio()
{
new randURL = random(sizeof(RandomMusic));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
StopAudioStreamForPlayer(i);
PlayAudioStreamForPlayer(i, RandomMusic[randURL]);
}
}
return 1;
}
CMD:radiostop(playerid, params[])
{
StopAudioStreamForPlayer(playerid);
return 1;
}
What does it do?, all the players will listen to 3 radio links with a lot of songs each link, the player has the option to turn off his stream with the command /radiostop.
Note: This is not tested.