Mysql problem -
anou1 - 06.01.2014
Hi,
I have a problem with something I founded in a tutorial,
I got those errors:
test2.pwn(251) : error 017: undefined symbol "GetPName"
test2.pwn(253) : error 035: argument type mismatch (argument 2)
Line 251:
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Argent) VALUES ('%s','%s,'0')",GetPName(playerid),EscapedText);
Line 253:
253: SendClientMessage(playerid,green,"You have been successfully registered!");
Could you please help me ?
Thank you
Re: Mysql problem -
HardRock - 06.01.2014
PHP код:
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Argent) VALUES ('%s','%s,'0')",GetPlayerName(playerid),EscapedText);
Show 'green'
Re: Mysql problem -
anou1 - 06.01.2014
green: #define green "{008000}"
EDIT: I changed it to
#define green 0x9EC73DAA
Now I got no problems with this.
But I still have the other error
test2.pwn(251) : error 017: undefined symbol "GetPName"
And if I use your " format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Argent) VALUES ('%s','%s,'0')",GetPlayerName(playerid),EscapedTex t);"
I got two warnings:
test2.pwn(251) : warning 202: number of arguments does not match definition
test2.pwn(251) : warning 202: number of arguments does not match definition
Re: Mysql problem -
sammp - 06.01.2014
It's wrong. SCM uses hexidecimal colours,
#define green 0x9BFF00FF
Re: Mysql problem -
HardRock - 06.01.2014
#define green 0x008000FF
//Edit: Show all code near...
Re: Mysql problem -
anou1 - 06.01.2014
It's from a mysql tutorial:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid,Regdialog,DIALOG_STYLE_INPUT,"Register - Enter your password","You are about to register a new account! \nPlease choose the password"" for it! \n","Register!","");
}
else
{
new Query[256];
new EscapedText[60];
mysql_real_escape_string(inputtext, EscapedText);
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Argent) VALUES ('%s','%s,'0')",GetPlayerName(playerid),EscapedText);
mysql_query(Query);
SendClientMessage(playerid,green,"You have been successfully registered!");
GivePlayerMoney(playerid,5000);
SetPlayerScore(playerid,1);
}
}
return 1;
}
Re: Mysql problem -
sammp - 06.01.2014
Where did you define GetPName?
Also. HardRock your "GetPlayerName" is totally wrong.
The correct syntax for it is:
GetPlayerName(playerid, const name[], len);
Re: Mysql problem -
sammp - 06.01.2014
Try this stock function though:
pawn Код:
stock GetPName(playerid)
{
new p[24];
GetPlayerName(playerid, p, sizeof(p));
return p;
}
Try that
Re: Mysql problem -
anou1 - 06.01.2014
So what should I use instead of " format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Argent) VALUES ('%s','%s,'0')",GetPlayerName(playerid),EscapedTex t);"
?
I'm sorry but I am a beginner so, how should I define GetPName ?
I tried to follow this tutorial:
https://sampforum.blast.hk/showthread.php?tid=305994
But even in the tutorial, they were errors.
Re: Mysql problem -
anou1 - 06.01.2014
This is the total code I got
Maybe it will help more
http://pastebin.com/0859GhJg