SA-MP Forums Archive
Error when there shouldn't be - 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 when there shouldn't be (/showthread.php?tid=89300)



Error when there shouldn't be - Joe Staff - 01.08.2009

I have something that's like this

pawn Код:
if(...)
{
  if(...)
  {
    ....
  }
  ...
  new string[3][4];
  ... Use string in here ....
}
if(...)
{
  if(...)
  {
    ...
  }
  ...
  new string[2][4]; line 50
  ... Use string in here ...
}
and I get an error
Код:
(50) : error 021: symbol already defined: "string"
But since they're not apart of the same section, why is it giving me that error?

ADDED* but when I comment line 50, it says Undefined Symbol "string"


Re: Error when there shouldn't be - -Sneaky- - 01.08.2009

It probably means you have "string" defined globally, somewhere on top of your gamemode, so change "string" to something else.


Re: Error when there shouldn't be - Joe Staff - 01.08.2009

It's an empty script, I'm starting from scratch. I don't really care though, I just changed the variable's name and got on with my life.


Re: Error when there shouldn't be - Kyle - 01.08.2009

Try this

Quote:
Originally Posted by Joe Staff
I have something that's like this

pawn Код:
if(...)
{
  if(...)
  {
    ....
  }
  ...
  new string[3][4];
  ... Use string in here ....
}
if(...)
{
  if(...)
  {
    ...
  }
  ...
  ... Use string in here ...
}
and I get an error
Код:
(50) : error 021: symbol already defined: "string"
But since they're not apart of the same section, why is it giving me that error?

ADDED* but when I comment line 50, it says Undefined Symbol "string"



Re: Error when there shouldn't be - Joe Staff - 01.08.2009

That causes the script to hault, because it's trying to set a string that doesn't exist. It's fine now, I just changed the name. I was just trying to make my script easy to add to for others.


Re: Error when there shouldn't be - MadeMan - 01.08.2009

Word "string" is sometimes used in functions parameters too, like

pawn Код:
MyFunction(playerid, string[])
so that may also cause that error.