SA-MP Forums Archive
How to play random streams ? - 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 to play random streams ? (/showthread.php?tid=350154)



How to play random streams ? - Rg-Gaming.Info - 11.06.2012

Hey guys i have a very cool idea about my gamemode but i need to know how can i play random audio streams ? Anyone can help me ?


Re: How to pay random streams ? - [MG]Dimi - 11.06.2012

First you need to choose which streams and then to take random of them. You can't play any random stream since 99.999999% of possible streaming URLs are invalid.

EDIT: Yes you can play mp3. Upload it and play it.


Re: How to pay random streams ? - Stevee - 11.06.2012

You can indeed play a MP3, though I don't know how to randomly play them, my guess would be randomly select one from an array of them using a timer of some sort?


Re: How to pay random streams ? - jamax - 11.06.2012

can we use like the url like gamemodename/scriptfiles/audio/blabla.mp3


Re: How to pay random streams ? - Rg-Gaming.Info - 11.06.2012

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
First you need to choose which streams and then to take random of them. You can't play any random stream since 99.999999% of possible streaming URLs are invalid.

EDIT: Yes you can play mp3. Upload it and play it.
No i think you didn't get what i ment... i meen i have my own uploaded sounds and i want to randomly play them when player dies. Whoops also sorry for the mistake in the name of the topic. Fixed it.


Re: How to play random streams ? - [MG]Dimi - 11.06.2012

Like this:
pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
    new url[120];
    switch(random(5))
    {
        case 0: url="...";
        case 1: url="...";
        case 2: url="...";
        case 3: url="...";
        case 4: url="..."; //your URLs in these fields. Add more or less depends of number of your sounds.
    }
    PlayAudioStreamForPlayer(playerid,url,0.0,0.0,0.0,0.0,0);
    return 1;
}



Re: How to play random streams ? - nickdodd25 - 11.06.2012

Well to play randomly the easyest way for me to do it would be to make an array to hold the urls for the streams. Then in your case, when the player dies, make it pick a random stream.

EDIT:Instead of a array [MG]Dimi's would work too

And as for sound clips you can upload any sounds you want here http://kiwi6.com/ and then copy the hotlink and it will stream for you.


Re: How to play random streams ? - Rg-Gaming.Info - 11.06.2012

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Like this:
pawn Код:
public OnPlayerDeath(playerid,killerid,reason)
{
    new url[120];
    switch(random(5))
    {
        case 0: url="...";
        case 1: url="...";
        case 2: url="...";
        case 3: url="...";
        case 4: url="..."; //your URLs in these fields. Add more or less depends of number of your sounds.
    }
    PlayAudioStreamForPlayer(playerid,url,0.0,0.0,0.0,0.0,0);
    return 1;
}
Ohh thank you very much i will give you credit for this function after i release my Version 2 of BFTDM.