23.03.2010, 13:01
pawn Код:
if(dialogid == LoGiN)
{
if(response) {
new file[128];
new string[128];
new PlayerName[24];
if(strlen(inputtext) == 0) {
GetPlayerName(playerid, PlayerName, sizeof PlayerName);
format(string, sizeof string, "Please enter a password \n\nWelcome %s! \nWe have detected that your account is registered \n\nPlease login to your account!", PlayerName);
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, "Account", string, "Login!", "Cancel.");
return 0;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/Admin/%s.ini",name);
if(fexist(file)) {
new password = dini_Int(file, "Password");
if(udb_hash(inputtext) != password) {
SendClientMessage(playerid, COLOR_RED, "Error ~ Incorrect password");
Kick(playerid);
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf("%s has failed to login", name);
}
else {
IsLogged[playerid] = 1;
SetPlayerScore(playerid, dini_Int(file, "Score"));
SendClientMessage(playerid, COLOR_GREEN, "Success ~ You have successfully logged into your account");
TogglePlayerSpectating(playerid, 0);
}
}
}
}