Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scriptTitle = "<color=cyan>[ADMIN]</color> <color=orange>[PASSWORD]</color>";
- transEmpty = "Please enter a password.";
- transSuccess = "Admin authority was successfully granted.";
- transWrong = "The password you entered is not valid. Please try again.";
- transTargetEmpty = "Please enter a player you want to admin.";
- transTargetSuccess = "Admin successfully granted to you.";
- transTargetIsAdmin = "The person you want to authorize is already Admin.";
- transUnSuccess = "Successfully received Admin authorization.";
- transUnTargetEmpty = "Please enter a player for which you want to get admin authority.";
- transUnTargetSuccess = "Your Admin authorization has been successfully received.";
- transUnTargetIsAdmin = "The person you want to authorize is not Admin.";
- adminPassword = "testPassword";
- command admin(){
- permission = "admin";
- execute(){
- isAdminSet(player.id, arguments[0], arguments[1], 1);
- }
- }
- command unadmin(){
- permission = "unadmin";
- execute(){
- isAdminSet(player.id, arguments[0], arguments[1], 2);
- }
- }
- function isAdminSet(player, target, password, type){
- player = toPlayer(player);
- if(target == "a"){
- if(type == 1){
- player.message(scriptTitle + " " + transTargetEmpty);
- }
- else if (type == 2){
- player.message(scriptTitle + " " + transUnTargetEmpty);
- }
- return;
- }
- target = toPlayer(target);
- if(type == 1){
- if(target.isAdmin == true){
- player.message(scriptTitle + " " + transTargetIsAdmin);
- return;
- }
- }
- else if (type == 2){
- if(target.isAdmin == false){
- player.message(scriptTitle + " " + transUnTargetIsAdmin);
- return;
- }
- }
- if(password == "a"){
- player.message(scriptTitle + " " + transEmpty);
- return;
- }
- if(password == adminPassword){
- if(type == 1){
- target.isAdmin = true;
- if(player.id != target.id){
- target.message(scriptTitle + " " + transTargetSuccess);
- }
- player.message(scriptTitle + " " + transSuccess);
- }
- else if (type == 2){
- target.isAdmin = false;
- if(player.id != target.id){
- target.message(scriptTitle + " " + transUnTargetSuccess);
- }
- player.message(scriptTitle + " " + transUnSuccess);
- }
- }
- else{
- player.message(str.format("{0} <color=red>{1}</color>", scriptTitle, transWrong));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement