SA-MP Forums Archive
"error 021: symbol already defined" pawn bug? - 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: "error 021: symbol already defined" pawn bug? (/showthread.php?tid=158867)



"error 021: symbol already defined" pawn bug? - Luk_Ass - 11.07.2010

When I use script like:
Код:
if (something)
{
	new xx[5][5]; // 5 just for example
}else{
	new xx[5][5]; // error 021: symbol already defined: "xx"
}
It will cause error 021: symbol already defined: "xx" on 5. line. Why?


There is everything ok:
Код:
if (something)
{
	new xx[5]; // 5 just for example
}else{
	new xx[5]; // 5 just for example
}
but if I use 2+ arrays [..][..], it will cause error.
Код:
if (something)
{
	new xx[5][5][5]; // 5 just for example
}else{
	new xx[5][5][5]; // error 021: symbol already defined: "xx"
}
It is a pawn bug?


Re: "error 021: symbol already defined" pawn bug? - Grim_ - 11.07.2010

pawn Код:
new xx[5];
if(something)
{
   //use of xx
}
else
{
  // use of xx
}



Re: "error 021: symbol already defined" pawn bug? - Luk_Ass - 11.07.2010

Hmm it's a possible solution, but I just wanted to use different arrays like:
pawn Код:
if (something)
{
    new xx[2][20];
}else{
    new xx[2][80];
}



Re: "error 021: symbol already defined" pawn bug? - Grim_ - 11.07.2010

Why would you need to do such?
Can you give an example on how you would use it after that.


Re: "error 021: symbol already defined" pawn bug? - RyDeR` - 11.07.2010

Just use it before 'if'.
I also don't understand why you need to do that?