12.03.2010, 16:07
pawn Код:
if (dialogid == DIALOG_TYPE_LOGIN)
{
if (response) {
new PlayerName[24];
if(strlen(inputtext) == 0) return ShowPlayerDialog(playerid, DIALOG_TYPE_LOGIN, DIALOG_STYLE_INPUT, "Account", "Error ~ Please enter a password \n\nWelcome to tRoleplay \nAs your account is registered please login to it \nYou will not be able to play this server until you login \n\nHint: To login enter the password used to register below and hit the button Login", "Login", "Cancel");
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"/tRoleplay/%s.ini",name);
if(fexist(file)) {
new password = dini_Int(file, "Password");
if(udb_hash(inputtext) != password) {
ShowPlayerDialog(playerid, DIALOG_TYPE_LOGIN, DIALOG_STYLE_INPUT, "Account", "Error ~ Incorrect password \n\nWelcome to tRoleplay \nAs your account is registered please login to it \nYou will not be able to play this server until you login \n\nHint: To login enter the password used to register below and hit the button Login", "Login", "Cancel");
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf("%s has failed to login", name);
}
else {
TogglePlayerSpectating(playerid, 0);
IsLogged[playerid] = 1;
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][Finalize] = dini_Int(file, "Finalize");
PlayerInfo[playerid][Gender] = dini_Int(file, "Gender");
PlayerInfo[playerid][City] = dini_Int(file, "City");
SendClientMessage(playerid, COLOR_GREEN, "You have successfully logged into your account");
}
}
}
if (!response) Kick(playerid);
}