SA-MP Forums Archive
Noob Problem [HELP!] - 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)
+--- Thread: Noob Problem [HELP!] (/showthread.php?tid=570547)



Noob Problem [HELP!] - Chausar - 11.04.2015

Код:
\GAMEMODE.pwn(679) : error 040: duplicate "case" label (value 0)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
I got this error while trying to compile the script. Pls solve this!

Код:
public OnCheckpointEnter(playerid, checkpointid)
{
	switch(checkpointid)

	{
		case Checkpoint 1:

		{
			
		}
		
		case ElCorona:  <<< This is the line of problem

		{
			
		}

	}
	return 1;
}



Re: Noob Problem [HELP!] - Konstantinos - 11.04.2015

Both of them are 0.

I'll give you an example to show you what I mean:
PHP код:
#define AB 0
#define BC 0

// somewhere:
new 5;
switch (
a)
{
    case 
AB: {}
    case 
BC: {}

error 040: duplicate "case" label (value 0) will be given because both AB and BC are defined as 0.


Error 040 duplicate case value 0 problem - Chausar - 12.04.2015

I dont Understand..what i supposed to do to fix error 040?

Код:
#define AB 0
#define BC 0

// somewhere:
new a = 5;
switch (a)
{
    case AB: {}
    case BC: {}
}



Re: Noob Problem [HELP!] - JaydenJason - 12.04.2015

Case AB is equal to 0
Case BC is equal to 0
Without definitions, it says

new a = 5;
switch (a)
{
case 0: {}
case 0: {}
}


Re: Noob Problem [HELP!] - Chausar - 12.04.2015

Thanks! fixed my problem!