07.06.2015, 04:55
Код:
#define CLIENT_MESSAGE_MAX_LENGTH 144 //144 is the maximum length of a client message public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(inputtext[0] == 0 || (inputtext[0] == 1 && inputtext[1] == 0)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","You have entered an invalid password.nType your password below to register a new account.","Register","Quit"); new string[CLIENT_MESSAGE_MAX_LENGTH]; WP_Hash(string,sizeof(string),inputtext); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteString(File,"Password",string); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_WriteInt(File,"Vip",0); INI_Close(File); new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format( string, sizeof(string), "Welcome To{CCFF33} Cyber{66CCFF} Malaysian{FFCC99} Army, {FF6600}%s", pname); SendClientMessage(playerid, 0xFFFFFFFF, string); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { new string[CLIENT_MESSAGE_MAX_LENGTH]; WP_Hash(string,sizeof(string),inputtext); if(!strcmp(string, PlayerInfo[playerid][pPass], false)) { new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok",""); format( string, sizeof(string), "Welcome Back, {FF6600}%s",pname); SendClientMessage(playerid, 0xFFFFFFFF, string); SendClientMessageToAll( -1, szStr); //What is szStr? } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.nType your password below to login.","Login","Quit"); } return 1; } } } return 1; }