Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if (dialogid == 1) // First Dialog (Register Dialog)
- { // Open brackelet!
- new name[MAX_PLAYER_NAME], file[256], string[128]; // his name, .ini file, string
- GetPlayerName(playerid, name, sizeof(name)); // Will get player's name !
- format(file, sizeof(file), PATH, name); // Search about .ini file name !
- if(!response) return Kick(playerid); // If he hit Exit, will get kicked !
- if (!strlen(inputtext)) return // What Password he will write in box !
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "-->{FF0000}H-Admin {0066CC}Register", "{FFFF00}Welcome !\n\n{FFFFFF}Account status: {FF0000}Not Registered\n\n{0066CC}Please enter your password below to continue register :", "Submit", "Exit"); // Register Dialog !
- dini_Create(file); // Dini will create .ini file for that player !
- dini_IntSet(file, "Password", udb_hash(inputtext)); // Will save his password ! He can login again just with his password !
- dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdmin] = 0); // Will save his Admin (0 now)
- dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500); // Will save his money, will be spawned with 500 $ !
- dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 1); // Will save his score, when he will be spawned with 1 Score !
- dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
- dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
- dini_IntSet(file, "Bonus",PlayerInfo[playerid][Bonus] = 0);
- format(string, 128, "{FF0000}[--> Succesfully <--]: {FFFF00}%s {0066CC} you have been registered. Your password it's {FF0000}%s !", name, inputtext); // Chat Message !
- SendClientMessage(playerid, -1, string); // Will put this message on registered player's chat!
- gPlayerLogged[playerid] = 1; // Now, he is Auto-Logged (he don't need to put again his password, only if he exit and enter again on server !)
- } // Closing Brackelet
- if (dialogid == 2) // Dialog 2 (Login Dialog)
- { // Open brackelet
- new name[MAX_PLAYER_NAME], file[256]; // player's name, .ini file, string
- GetPlayerName(playerid, name, sizeof(name)); // Will get player's name !
- format(file, sizeof(file), PATH, name); // Search about .ini file from that player !
- if(!response) return Kick(playerid); // If he hit Exit he will be kicked !
- if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "-->{FF0000}H-Admin {0066CC}Login", "{FFFF00}Welcome !\n\n{FFFFFF}Account status: {15FF00}Registered\n\n{0066CC}Please enter your password below, to continue login :", "Submit", "Exit"); // Our Login Dialog !
- new tmp; // Variable !
- tmp = dini_Int(file, "Password"); // Password !
- if(udb_hash(inputtext) != tmp) // In that box if he don't put correct password from .ini file then :
- { // Open Brackelet
- SendClientMessage(playerid, -1, "{FF0000}Wrong password! {0066CC}Try another one !"); // He will cannot login !
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "-->{FF0000}Login {0066CC}Account", "{FF0000}Wrong password !\n{0066CC}Please enter your real password to continue!", "Login", "Exit"); // And if his password it's wrong he will saw again our Login Dialog, to try again log in !
- } // Closin brackelet !
- else // Else
- { // Open brackelet !
- gPlayerLogged[playerid] = 1; // 1 = He it's logged !
- PlayerInfo[playerid][pAdmin] = dini_Int(file, "AdminLevel"); // If he have Admin, in .ini file will load his Admin before login !
- SetPlayerScore(playerid, PlayerInfo[playerid][pScore]); // Will sets his score from last time , from .ini file !
- GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid)); // He will get money from last time, from .ini file !
- SendClientMessage(playerid, -1, "{FF0000}[--> Succesfully <--]: {0066CC}You have been {FFFF00}successfully {0066CC}logged in!"); // This he will saw after Login !
- } // Closing brackelet *1 !
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement