SA-MP Forums Archive
How would one run an .mp3 with PlayAudioStreamForPlayer? - 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: How would one run an .mp3 with PlayAudioStreamForPlayer? (/showthread.php?tid=599785)



How would one run an .mp3 with PlayAudioStreamForPlayer? - Counterafk - 30.01.2016

I've seen on several servers people have the same song play upon logging in(that plays from start to end)


so instead of the PlayAudioStreamForPlayer url being an ip that just connects to a radio, how do I make a specific song play from start to end by each player?

Thanks!


Re: How would one run an .mp3 with PlayAudioStreamForPlayer? - Crystallize - 30.01.2016

Код:
public OnPlayerConnect(playerid)
{
	PlayAudioStreamForPlayer(playerid,"URL.mp3 "); // plays the music when player connects
	return 1; // returns true. 
}
Код:
CMD:stopstream(playerid, params[])
{
    StopAudioStreamForPlayer(playerid); //Stops the music , just in case. 
    return 1; // returns true. 
}



Re: How would one run an .mp3 with PlayAudioStreamForPlayer? - Tamy - 30.01.2016

You need a link to that song to any web-server which supports the music streaming and you can store that link in a global string variable in your script, something like this.

Код:
new yourstr[] = "link here";
When ever you want to play the same song for anyone;
Код:
PlayAudioStreamForPlayer(playerid, yourstr);



Re: How would one run an .mp3 with PlayAudioStreamForPlayer? - Counterafk - 30.01.2016

Thanks Tamy! repped[Tamy] ++;


Re: How would one run an .mp3 with PlayAudioStreamForPlayer? - Crystallize - 30.01.2016

My mistake i've read it bad, here.
Код:
CMD:stream(playerid, params[])
{
    new string[128];
    if(isnull(params)) return SendClientMessage(playerid, LIGHT_RED, "USAGE: /stream [Url]");
    new HighestPlayerId = GetPlayerPoolSize();
for(new x=0; x <= HighestPlayerId; x++) {
        if(!IsPlayerConnected(x)) continue;
        format(string, sizeof(string), "%s(%d)Is streaming music", IsPlayerName(playerid), playerid);
    SendClientMessage(x, 0x00FFFFFF, string);
        PlayAudioStreamForPlayer(x, params);
    }
    }
return 1;
}
CMD:stopstream(playerid, params[])
{
    StopAudioStreamForPlayer(playerid);
    return 1;
}



Re: How would one run an .mp3 with PlayAudioStreamForPlayer? - Sew_Sumi - 30.01.2016

You can also point it to .pls playlists.