String error - 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: String error (
/showthread.php?tid=325883)
String error -
GNGification - 15.03.2012
Allright I havent been using strings too much, I know how they work but right now im not sure how this error should be fixed.
ERROR:
Код:
H:\Pawno\pawno\LS.pwn(1007) : error 021: symbol already defined: "string"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Strings defined in OnPlayerConnect
first string
Код:
new string[71];
format(string, sizeof(string), "blablabla
mysql_query(string);
second string
Код:
new iString[412];
format(iString, sizeof(iString), "blablablaa...
and the error string
Код:
mysql_free_result();
new playrname[MAX_PLAYER_NAME], string[ 256 ];
PS line 1007 = ''new playrname[MAX_PLAYER_NAME, string blablabla->
Maybe its time for me to learn more about strings^^
Thank you for your time! this is propably really simple for experienced scripters
Re: String error -
ReneG - 15.03.2012
You cannot define two of the same variables/strings in one callback.
Bad Way
pawn Код:
public OnPlayerConnect(playerid)
{
new string[20];
format(string,sizeof(string),"blah blah",1);
new string[23]; // You already defined it in the same callback.
return 1;
}
Good Way
pawn Код:
public OnPlayerConnect(playerid)
{
new string[20];
format(string,sizeof(string),"blah blah",1);
new string2[23]; // The new string is different because it has a 2 in it.
return 1;
}
Just change the second time 'string' appears in your OnPlayerConnect callback to something else.
Re: String error -
GNGification - 15.03.2012
Thanks! exactly that I was looking for
thank you + rep!
Re: String error -
HighPitchedVoice - 15.03.2012
VincentDunn, you know what you are talking about!