30.11.2012, 19:31
Hi guys!
I've got a problem with my login script. I learned the MySQL stuff from ->https://sampforum.blast.hk/showthread.php?tid=305994 but there's a little bug in the login part.
About the bug. When you type in a wrong password or a right password, the script just logs u in.
When you type a wrong password, the script should say, that you've entered a wrong password, but it doesnt.
The code:
(I translated the code quickly, so u might find some mistakes. )
I've got a problem with my login script. I learned the MySQL stuff from ->https://sampforum.blast.hk/showthread.php?tid=305994 but there's a little bug in the login part.
About the bug. When you type in a wrong password or a right password, the script just logs u in.
When you type a wrong password, the script should say, that you've entered a wrong password, but it doesnt.
The code:
pawn Код:
stock LogMeIn(playerid,const password[])
{
new EscapedText[60], Query[80], pName[24];
GetPlayerName(playerid,pName,24);
mysql_real_escape_string(password, EscapedText);
format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `name` = '%s' AND `pass` = '%s'",pName,EscapedText);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
SendClientMessage(playerid,yello2,"U've just log'd in!");
LoadStats(playerid);
}
else
{
ShowPlayerDialog(playerid, Valepass, DIALOG_STYLE_PASSWORD, "Wrong password!", "Wrong password!", "Login", "Leave");
}
mysql_free_result();
return 1;
}