String error
#1

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
Reply
#2

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.
Reply
#3

Thanks! exactly that I was looking for
thank you + rep!
Reply
#4

VincentDunn, you know what you are talking about!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)