SA-MP Forums Archive
Duplication in case ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Duplication in case ? (/showthread.php?tid=66845)



Duplication in case ? - the_driver - 24.02.2009

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.



Re: Duplication in case ? - yom - 24.02.2009

Why you use | ?


Re: Duplication in case ? - the_driver - 24.02.2009

to seperate them for eachother, not ok ?

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


Re: Duplication in case ? - [RP]Rav - 24.02.2009

use commas


Re: Duplication in case ? - yom - 24.02.2009

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

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