How to play random streams ?
#1

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 ?
Reply
#2

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.
Reply
#3

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?
Reply
#4

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

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.
Reply
#6

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;
}
Reply
#7

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.
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)