Script Question
#1

Код:
            	new zskin = random(3);
 	            switch(zskin) {
  	        	case 0:SetPlayerSkin(playerid,230);
            	case 1:SetPlayerSkin(playerid,162);
            	case 2:SetPlayerSkin(playerid,137);
            	case 3:SetPlayerSkin(playerid,212);
            	case 4:SetPlayerSkin(playerid,135);
            	case 5:SetPlayerSkin(playerid,200);
     	        case 6:SetPlayerSkin(playerid,79);
     	        case 7:SetPlayerSkin(playerid,134);
	}
    }
Hello i have an Question, what causes the random(3); ?
Reply
#2

random(3); will return a number between 0 and 2 (0,1,2)
random(n); will return a number between 0 and n-1 (0,1,......(n-1))

In your case, you want random( 8 ); so you get 0 to 7 for your switch.
Reply
#3

Also i need for that an random(8); ?
Reply
#4

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Also i need for that an random(; ?
Yup. Else you will never get the cases 3-7.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)