Very Weird issue with " expected token: ",", but found ";"" -
tuuker - 22.12.2012
Getting error: expected token: ",", but found ";" for some reason as it's not that error at all.
pawn Code:
LoginPlayer(playerid,password[])
{
if(strcmp(password, UserStats[playerid][pPass])) {
SendClientMessage(playerid,COLOR_RED,"Wrong password!");
} else {
LoadAccount(playerid);
}
return 1;
}
After i call LoadAccount(playerid); at LoginPlayer that i made, the error occurs.
It says that this error occurs at 364 line where i have:
pawn Code:
format(query,sizeof(query), "SELECT * FROM `accounts` WHERE `id` = %d",UserStats[playerid][ID];
mysql_function_query(mysqlconnect, query, true, "OnAccountLoad", "d", playerid);
Seems perfect to me...
Re: Very Weird issue with " expected token: ",", but found ";"" -
tuuker - 22.12.2012
Omg, how i didn't see lol, i thought it may be some bug but no, it's me ^^ forgot ) at format, damn... I feel silly now
Re: Very Weird issue with " expected token: ",", but found ";"" -
SKAzini - 22.12.2012
Remember that there is other people who might have the same issue as you and looks at this topic, not finding a solution, therefore, you should post the solution if you've solved it.
This is the solution for people who might have the same problem:
pawn Code:
format(query,sizeof(query), "SELECT * FROM `accounts` WHERE `id` = %d",UserStats[playerid][ID]);
mysql_function_query(mysqlconnect, query, true, "OnAccountLoad", "d", playerid);
The solution is to add a parenthese between the closing bracket and the semicolon at UserStats[playerid][ID]
);.
Re: Very Weird issue with " expected token: ",", but found ";"" -
Babul - 22.12.2012
i think that "bug" occured when he typed in the format line with all parameters, and to avoid a too long line, which cannot be read when the cursor is at the left position, he decided to add a newline.
the usual habbit to end (almost) each line with a ; semicolon, caused him to do that instead typing a , comma required in order to let the second line be added as parameters for the previous format().
i had the missing ) of the format line in mind aswell, but the error itself is description enough
(yet) best solution: (will get you used to indent your code properly)
Code:
format(query,sizeof(query), "SELECT * FROM `accounts` WHERE `id` = %d",
UserStats[playerid][ID],
mysql_function_query(mysqlconnect,
query,
true,
"OnAccountLoad",
"d",
playerid
);
leads you to optimize that line a bit to be able to read your gamemode again, so heres the...
best solution:
Code:
format(query,sizeof(query), "SELECT * FROM `accounts` WHERE `id` = %d",UserStats[playerid][ID],mysql_function_query(mysqlconnect, query, true, "OnAccountLoad", "d", playerid);