Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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", "You have entered an invalid password.\n\nType your password below to register a new account.","Register","Quit");
- new Hpass[129];
- WP_Hash(Hpass,sizeof(Hpass), inputtext);
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteString(File,"Password", Hpass);
- INI_Close(File);
- PlayerInfo[playerid][posX] = 1981.6018;
- PlayerInfo[playerid][posY] = -2484.5366;
- PlayerInfo[playerid][posZ] = 13.5391;
- PlayerInfo[playerid][pVW] = 0;
- PlayerInfo[playerid][pInterior] = 0;
- PlayerInfo[playerid][pMoney] = 2500;
- PlayerInfo[playerid][pHealth] = 100;
- PlayerInfo[playerid][pSkin] = 299;
- SetSpawnInfo(playerid, 0, 0, 1981.6018,-2484.5366,13.5391, 0, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SendClientMessage(playerid, -1, "Congratulation, you have successfully registered on our server!");
- SendClientMessage(playerid, -1, "You have been given 2500$ to start in the city!");
- SendClientMessage(playerid, -1, "Use /help for more information!");
- }
- }
- case DIALOG_LOGIN:
- {
- new
- String[100];
- if(!response) return Kick(playerid);
- if(response)
- {
- new Hpass[129];
- WP_Hash(Hpass,sizeof(Hpass),inputtext);
- if(!strcmp(Hpass, PlayerInfo[playerid][pPass], false))
- {
- if(PlayerInfo[playerid][pBan] == 1)
- {
- Kick(playerid);
- }
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- SetSpawnInfo(playerid, 0, 0, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ], PlayerInfo[playerid][posA], 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SendClientMessage(playerid, -1, "You have successfully logged in.");
- }
- else
- {
- format(String, sizeof(String), "Welcome back, %s. \n\nYou have entered an incorrect password.\n\nType your password below to login.", GetName(playerid));
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login", String,"Login","Quit");
- }
- return 1;
- }
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment