11.04.2011, 09:26
Hello, so when I try to log in it wont log me in even with the correct password.
My code:
I don't really get whats the problem, can u please help me? thanks.
My code:
pawn Код:
if(dialogid == Logindialog)
{
new buffer[200];
if(!response) return Kick(playerid) && SendClientMessage(playerid,red,"Have it Your way!");
mysql_real_escape_string(inputtext,inputtext);
mysql_real_escape_string(GetPName(playerid),GetPName(playerid));
format(Query, sizeof(Query), "SELECT `Password` FROM `Accounts` WHERE `Username` = '%s'",
GetPName(playerid));
mysql_query(Query);
mysql_store_result();
WP_Hash(buffer, sizeof(buffer), inputtext);
if(!strcmp(buffer, pinfo2[playerid][pPassword], true))
{
LoadAccountVariables(playerid);
pinfo2[playerid][hours] = pinfo2[playerid][hours];
pinfo2[playerid][mins] = pinfo2[playerid][mins];
SetPVarInt(playerid,"Logged2",1);
Showinfo2(playerid,"~g~Successfully logged in!");
TogglePlayerSpectating(playerid,0);
mysql_free_result();
PInfo[playerid][Failedlogins] = 0;
}
else
{
PInfo[playerid][Failedlogins] ++;
format(string,sizeof(string),""lred"Logins failed: %i/3 \n"lwhite"Hey, "lgreen"%s!{00A5FF}\nYour account is registered, please enter the password below!\n"lwhite"Or press cancel to "lred"leave",PInfo[playerid][Failedlogins],GetPName(playerid));
ShowPlayerDialog(playerid,Logindialog,1,"Login",string,"Ok","Cancel");
Showinfo2(playerid,"~r~~h~Incorrect password!");
TogglePlayerSpectating(playerid,1);
if(PInfo[playerid][Failedlogins] == 3)
{
format(string,sizeof(string),"*** %s has been automatically as they entered the wrong password 3 times.",GetPName(playerid));
Kick(playerid);
SendClientMessageToAll(red,string);
}
return 1;
}
}