Duplication in case ?
#1

Hey all i was busy coloring skins and i had an error
Script:
Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerPos(playerid, 154.3292,-1944.7362,4.2207);
	SetPlayerInterior(playerid, 0);
 	switch(gClass[playerid])
	{
	
	// Grove Street
	
	case 269 | 270 | 271 | 0:
		{
			SetPlayerColor(playerid, COLOR_GREEN);
  	}
  	
  	// Ballas
  	
	case 163 | 102 | 103 | 104:
	  {
	    SetPlayerColor(playerid, COLOR_PURPLE);
		}
		
	// Varios Los Aztecas
	
	case 166 | 114 | 115 | 116:
	  {
	    SetPlayerColor(playerid, COLOR_LIGHTGREEN);
		}
		
	// Los Santos Vagos
	
	case 17 | 108 | 109 | 110:
	  {
	    SetPlayerColor(playerid, COLOR_YELLOW);
		}

	// Hitman
		
	case 113 | 117 | 118 | 120:
	  {
	    SetPlayerColor(playerid, COLOR_BLACK);
		}
	}
	return 1;
}
Now this is the error:
Код:
reeroam.pwn(366) : error 040: duplicate "case" label (value 127)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
line 366 is:
Код:
	case 113 | 117 | 118 | 120:
If i remove the 120 it works fine but as long as it is on it doesnt work.. anyone got an idea ??

GrTz.
Reply
#2

Why you use | ?
Reply
#3

to seperate them for eachother, not ok ?

Edit:
Hehe lol thanks i just tried for fun without " | " and used " , " and it works..
Thanks man !
Reply
#4

use commas
Reply
#5

| is an operator, such as +, -, & etc.

When you do (113 | 117 | 118 | 120), it results as 127 (as indicated in the error message).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)