Random Music
#6

Hold on, let me show you how a switch-statement should look:
pawn Код:
stock RandomMusic(playerid)
{
    new rand = random(5);
    switch(rand)
    {
        case 0:
        {
            PlayAudioStreamForPlayer(playerid, "http://mp3.shmidt.net/files/from_flash/2156/f8d0b9b35fccc03a31d990b62940b9e448febe9db1a41661ce/Nelly_-_Here_Comes_The_Boom.mp3");
        }
        case 1:
        {
            PlayAudioStreamForPlayer(playerid, "http://raddad.free.fr/musiquepuce///'Til I collapse.mp3");
        }
        case 2:
        {
            PlayAudioStreamForPlayer(playerid, "http://a.tumblr.com/tumblr_lpb606uHE91qhb27eo1.mp3");
        }
        case 3:
        {
            PlayAudioStreamForPlayer(playerid, "http://a.tumblr.com/tumblr_m0uvryGX7P1r60k0fo1.mp3");
        }
        case 4:
        {
            PlayAudioStreamForPlayer(playerid, "http://mp3ska4ka.ru/audio/107519246/54624629/Roy_Jones_Jr-Go_Hard_Or_Go_Home.mp3");
        }
    }
    return 1;
}
See? It's way cleaner and it's easier to see the matching brackets this way. Use the TAB key to indent your code.
Reply


Messages In This Thread
Random Music - by itachi - 12.02.2015, 18:43
Re: Random Music - by HazardouS - 12.02.2015, 18:46
Re: Random Music - by itachi - 12.02.2015, 18:53
Re: Random Music - by HazardouS - 12.02.2015, 18:57
Re: Random Music - by itachi - 12.02.2015, 19:01
Re: Random Music - by HazardouS - 12.02.2015, 19:02
Re: Random Music - by itachi - 12.02.2015, 19:04
Re: Random Music - by HazardouS - 12.02.2015, 19:07
Re: Random Music - by itachi - 12.02.2015, 19:09

Forum Jump:


Users browsing this thread: 1 Guest(s)