PHP код:
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_PASSWORD, ""COL_WHITE"REGISTRATION",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to register.","Proceed","Cancel");
if(strlen(inputtext) < 6)
{
SendClientMessage(playerid, Your_color, "Your password must contain more than 6 letters"); // and then
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"REGISTRATION",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to register.","Proceed","Cancel");
return 1;
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
GivePlayerMoney(playerid, 500);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME!",""COL_WHITE"Welcome! Please use {F81414}/CMDS {FFFFFF}if you need server's helps.","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,""COL_WHITE"WELCOME BACK!",""COL_WHITE"Your {00FF22}stats {FFFFFF}has been automaticlly loaded!","Ok","");
PlayerPlaySound(playerid, 1052, 1310.0979, -1380.9642, 13.7142);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"LOGIN",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to log in.","Done","Quit");
PlayerPlaySound(playerid, 1053, 1310.0979, -1380.9642, 13.7142);
}
return 1;
}
}
}
return 1;
}