07.03.2014, 07:57
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register - Los Santos Battlefields",""cgreen"Your Account is Unregistered!\nPlease type your password here to Register!","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",50000); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_WriteInt(File,"Hours",0); INI_WriteInt(File,"Minutes",0); INI_WriteInt(File,"Seconds",0); INI_WriteInt(File,"Scores",0); INI_WriteInt(File,"VIP",0); INI_Close(File); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You're succesfully creating an password!\nPlease dont give your password to anyone if you dont want to be hacked!\nPlease write your password on a note to remember it!","Ok",""); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You have successfully logged in!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login - Los Santos Battlefield",""cgreen"Your Account is Registered!\nPlease type your password here to Login!","Login","Quit"); } return 1; } } return 1; }