Errors on MySQL Line
#1

Hey, I'm trying to add a MySQL system to a blank gamemode(making my own).
But its giving me errors on this line:
Код:
	format(Query,sizeof,(Query) "SELECT name FROM playerdata WHERE user='%s'",PlayerName(playerid));
Errors:
Код:
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(46) : error 020: invalid symbol name ""
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(46) : warning 215: expression has no effect
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(46) : error 001: expected token: ";", but found "-string-"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(46) : warning 215: expression has no effect
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(46) : error 001: expected token: ";", but found ")"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(46) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

try this.

pawn Код:
format(Query,sizeof(Query), "SELECT name FROM playerdata WHERE user='%s'",PlayerName(playerid));
you had a comma after sizeof, it should be after sizeof(Query)
Reply
#3

I get more errors.
Which is showing stuff isnt defined and they are:
Код:
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(51) : error 017: undefined symbol "DIALOG_STYLE_PASSWORD"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(57) : error 017: undefined symbol "DIALOG_Register"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(231) : error 017: undefined symbol "dialog"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(236) : error 017: undefined symbol "kick"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(241) : error 001: expected token: ")", but found ","
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(252) : error 017: undefined symbol "DIALOG_STYLE_PASSWORD"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(265) : error 017: undefined symbol "kick"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(270) : error 001: expected token: ")", but found ","
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(285) : warning 203: symbol is never used: "playerid"
C:\Other Stuff\My SAMP Server\gamemodes\BlankGamemode.pwn(294) : error 017: undefined symbol "MAX_PLAYER"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


9 Errors.
EDIT: Here's my OnPlayerConnect:
Код:
public OnPlayerConnect(playerid)
{
	new Query[100];
	format(Query,sizeof(Query),"SELECT name FROM playerdata WHERE user='%s'",PlayerName(playerid));
	mysql_query(Query);
	mysql_store_result();
	if(mysql_num_rows()>0)
	{
		 ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Welcome.\nThis account is already registered\nType the password in below","Login","Leave");
		 
	
	}
	else
	{
 		ShowPlayerDialog(playerid,DIALOG_Register,DIALOG_STYLE_PASSWORD,"Register","Welcome.\nThis account is not registered\nType the password in below you wish to use","Login","Leave");

	}
	mysql_free_result();
	return 1;
}
Reply
#4

Try replacing with this.
PHP код:
format(Query,sizeof(Query), "SELECT `name` FROM `playerdata` WHERE `user` ='%s'",PlayerName(playerid)); 
Reply
#5

Same errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)