30.07.2014, 08:23
When player requests class, not spawn, class.
DPE Callback
LoadPlayer
And now login dialog
But when I try to log in it accepts every string as a valid password and logs in.
What's the problem?
pawn Код:
mysql_format(base_handle, query, sizeof(query), "SELECT * FROM accounts WHERE name = '%e' LIMIT 0,1", GetName(playerid));
mysql_tquery(base_handle, query, "DoesPlayerExist", "i", playerid);
pawn Код:
forward DoesPlayerExist(playerid);
public DoesPlayerExist(playerid) { // Callback for MySQL check
new rows = mysql_num_rows();
new string[256];
if(!rows) {
format(string, sizeof(string), "{24B2FF}%s{FFFFFF}, welcome to {FF3636}Reloaded TDM{FFFFFF}!\nPlease type {FF3636}6-24 charachters{FFFFFF} long password to register!", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", string, "Register", "Cancel");
}
else {
format(string, sizeof(string), "{24B2FF}%s{FFFFFF}, welcome back to {FF3636}Reloaded TDM{FFFFFF}!\nPlease log in using your password!", GetName(playerid));
LoadPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Cancel");
}
return 1;
}
pawn Код:
stock LoadPlayer(playerid) { // Loading player
new temp[24];
cache_get_row(0, 0, temp); PlayerInfo[playerid][pSQLID] = strval(temp);
cache_get_row(0, 1, PlayerInfo[playerid][pName]);
cache_get_row(0, 2, PlayerInfo[playerid][pPass]);
cache_get_row(0, 3, temp); SetPlayerScore(playerid, strval(temp));
printf("Loaded player %s", GetName(playerid));
return 1;
}
pawn Код:
case 400: {
new string[256];
if(!response) return Kick(playerid);
if(strcmp(inputtext, PlayerInfo[playerid][pPass], false) == 0) {
ForceClassSelection(playerid);
format(string, sizeof(string), "{24B2FF}Reloaded TDM:{FFFFFF} Welcome back, %s!", GetName(playerid));
SendClientMessage(playerid, COLOR_WHITE, string);
}
else {
format(string, sizeof(string), "{24B2FF}%s{FFFFFF}, welcome back to {FF3636}Reloaded TDM{FFFFFF}!\nPlease log in using your password!\n\n{FF3636}Wrong password, try again!", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Cancel");
}
}
What's the problem?