SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/12/2012, 11:15 AM   #1
tuuker
Big Clucker
 
Join Date: Dec 2010
Posts: 73
Reputation: 8
Default Very Weird issue with " expected token: ",", but found ";""

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...
tuuker is offline   Reply With Quote
Old 22/12/2012, 11:18 AM   #2
tuuker
Big Clucker
 
Join Date: Dec 2010
Posts: 73
Reputation: 8
Default Re: Very Weird issue with " expected token: ",", but found ";""

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
tuuker is offline   Reply With Quote
Old 22/12/2012, 01:25 PM   #3
SKAzini
Huge Clucker
 
SKAzini's Avatar
 
Join Date: Jun 2012
Posts: 376
Reputation: 17
Default Re: Very Weird issue with " expected token: ",", but found ";""

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]);.
SKAzini is offline   Reply With Quote
Old 22/12/2012, 01:32 PM   #4
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,782
Reputation: 251
Default Re: Very Weird issue with " expected token: ",", but found ";""

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);
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 001: expected token: "-string end-", but found "-identifier-" iGetty Scripting Help 3 15/05/2012 06:39 PM
C:\Users\Andy\Documents\Connor\NRP - New\gamemodes\NRP.pwn(2126) : error 001: expected token: ")", but found "{" NewerthRoleplay Scripting Help 2 14/03/2012 09:47 PM
error 001: expected token: "-string end-", but found "-identifier-" Any Ideas? Jack_Rocker Scripting Help 4 04/11/2011 02:03 PM
D:\Mis documentos\Server\gamemodes\lscnr.pwn(30602) : error 001: expected token: ",", but found ";" [M]xFire Help Archive 3 27/08/2010 08:11 PM


All times are GMT. The time now is 09:52 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.