26.01.2018, 06:22
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[270], strings[270], playername[25];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
if(dialogid == DIALOG_REGISTER)
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_GREEN"Register",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(AccountsPath(playerid));
INI_SetTag(File,"Player Data");
INI_WriteInt(File,"Password",num_hash(inputtext));
INI_Close(File);
format(string, sizeof string,"%s has registered a new account", playername);
SendClientMessageToAll(COLOR_YELLOW, string);
}
}
if(dialogid == DIALOG_LOGIN)
{
if (!response) return Kick (playerid);
if(response)
{
if(num_hash(inputtext) == PlayerInfo[playerid][PlayerPass])
{
INI_ParseFile(AccountsPath(playerid), "LoadPlayer_%s", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid, PlayerInfo[playerid][PlayerScore]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_RED"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
return 1;
}