Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if (dialogid == 1)
- {
- new file[256], string[131];
- format(file, sizeof(file), SERVER_USER_FILE, GetPlayerNameEx(playerid));
- if(!response) return Kick(playerid);
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "{CC0000}Registration", "GMNAME \nIt seems like you are not registered, type your password to continue.", "Register", "Cancel");
- dini_Create(file);
- dini_IntSet(file, "Password", udb_hash(inputtext));
- dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
- dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 0);
- dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
- dini_IntSet(file, "Job",PlayerInfo[playerid][pJob] = 0);
- dini_IntSet(file, "Color",PlayerInfo[playerid][pColor] = 0);
- dini_IntSet(file, "Vw",PlayerInfo[playerid][pVw] = 0);
- dini_IntSet(file, "Int",PlayerInfo[playerid][pInt] = 0);
- dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns] = 0);
- dini_IntSet(file, "Skin",PlayerInfo[playerid][pSkin] = 0);
- if(PlayerInfo[playerid][pReg] == 0) { GivePlayerCash(playerid, 250); }
- dini_IntSet(file, "Reg",PlayerInfo[playerid][pReg] = 1);
- format(string, 131, "You succesfully registered the name %s with password %s, you have been auto logged in.", GetPlayerNameEx(playerid), inputtext);
- SCM(playerid, COLOR_WHITE, string);
- gPlayerLogged[playerid] = 1;
- SpawnPlayer(playerid);
- }
- if (dialogid == 2)
- {
- new file[256];
- format(file, sizeof(file), SERVER_USER_FILE, GetPlayerNameEx(playerid));
- if(!response) return Kick(playerid);
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "{CC0000}Login", "GMNAME \nYou are registered thanks for joining us , type your password to continue.", "Login", "Cancel");
- new tmp;
- tmp = dini_Int(file, "Password");
- if(udb_hash(inputtext) != tmp) {
- SCM(playerid, COLOR_RED, "Wrong Password, try again.");
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{CC0000}Login", "GMNAME \n{CC0000}WRONG PASSWORD\n{CC0000}Type in your password correctly to continue.", "Login", "Cancel");
- }
- else
- {
- gPlayerLogged[playerid] = 1;
- PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
- PlayerInfo[playerid][pSkin] = dini_Int(file, "Skin");
- PlayerInfo[playerid][pReg] = dini_Int(file, "Reg");
- SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
- SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
- SetPlayerMoney(playerid, PlayerInfo[playerid][pCash]);
- GivePlayerCash(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));//
- SCM(playerid,COLOR_RED, "Successfully logged in!");
- SpawnPlayer(playerid);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment