Errors on MySQL Line - 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: Errors on MySQL Line (
/showthread.php?tid=318745)
Errors on MySQL Line -
BleverCastard - 16.02.2012
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.
Re: Errors on MySQL Line -
[Diablo] - 16.02.2012
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)
Re: Errors on MySQL Line -
BleverCastard - 16.02.2012
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;
}
Re: Errors on MySQL Line -
Mrki_Drakula - 16.02.2012
Try replacing with this.
PHP код:
format(Query,sizeof(Query), "SELECT `name` FROM `playerdata` WHERE `user` ='%s'",PlayerName(playerid));
Re: Errors on MySQL Line -
BleverCastard - 16.02.2012
Same errors.