Help with break;
#1

Код:
forward song();
public song()
{
	new rand = random(3);
	for(new i = 0; i < MAX_PLAYERS; i++)
	    if(radiop[i] == 1)
		{
 			StopAudioStreamForPlayer(i);
                        switch(rand)
			{
	    		case 0:
   			    {
		 			PlayAudioStreamForPlayer(i, "http://iusmix.altervista.org/Radio/Skrillex_First_of_the_year.mp3");
		 			SendClientMessage(i, COLOR_YELLOW, "*** Brano corrente: Skrillex - First Of The Year.");
		 			varxkill = SetTimer("song", 263000, false);
		 			break;
    			}
		    	case 1:
				{
					PlayAudioStreamForPlayer(i, "http://iusmix.altervista.org/Radio/Skrillex_-_Rock_n_Roll__Will_Take_You_to_the_Mountain_.mp3");
					SendClientMessage(i, COLOR_YELLOW, "*** Brano corrente: Skrillex - Rock n' Roll.");
				    varxkill = SetTimer("song", 270000, false);
					break;
				}
		    	case 2:
				{
			   		 PlayAudioStreamForPlayer(i, "http://iusmix.altervista.org/Radio/Skrillex_-_Right_In.mp3");
			   		 SendClientMessage(i, COLOR_YELLOW, "*** Brano corrente: Skrillex - Right In.");
					 varxkill = SetTimer("song", 183000, false);
					 break;
				}
			}
			SendClientMessage(i, COLOR_YELLOW, "*** Per fermare questo brano digita/stop!");
		}
}
Hello, this script should start a randomized playlist (i put only 3 cases), logically is correct, but the song start only for the ID 0 player, because "break;" does is function for switch and for...
Why break quit the switch and for, and how can i resolve it?

Sorry for my bad english.
Reply


Messages In This Thread
Help with break; - by Minatoo - 30.12.2014, 17:02
Re: Help with break; - by Schneider - 30.12.2014, 17:12
Re: Help with break; - by Minatoo - 30.12.2014, 17:15
Re: Help with break; - by Minatoo - 31.12.2014, 16:40
Re: Help with break; - by LivingLikeYouDo - 31.12.2014, 16:42

Forum Jump:


Users browsing this thread: 1 Guest(s)