Thread: How to give ranks- the command

Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1 How to give ranks- the command 
    Extreme Donator
    booher's Avatar
    Join Date
    Jul 2007
    Age
    27
    Posts
    461
    Thanks given
    2
    Thanks received
    20
    Rep Power
    46
    Credits: booher (i am massscape from moparscape.

    Purpose: To show you how to give/ take permissions though command.

    Difficulty: 1.

    Assumed Knowledge: Reading, copy and pasting.

    Server Base: Any Source.

    Classes Modified: Client.java.

    ---

    Step 1.

    Search for:
    Code:
    if(command.st
    Step 2.

    Add this under the end of the command:

    Code:
    if(command.startsWith("giveadmin") && playerRights >= 3) {
       String name = command.substring(10);
       try {
          int p = PlayerHandler.getPlayerID(name);
          client c = (client) server.playerHandler.players[p];
          c.playerRights = 2;
          c.savemoreinfo();
          c.savechar();
          c.disconnected = true;
          sendMessage(name+" is now an Administrator");
       } catch(Exception e) {
          sendMessage(name+" either isn't online or doesn't exist");
       }
    }
    else if(command.startsWith("givemod") && playerRights >= 3) {
       String name = command.substring(8);
       try {
          int p = PlayerHandler.getPlayerID(name);
          client c = (client) server.playerHandler.players[p];
          c.playerRights = 1;
          c.savemoreinfo();
          c.savechar();
          c.disconnected = true;
          sendMessage(name+" is now a Moderator");
       } catch(Exception e) {
          sendMessage(name+" either isn't online or doesn't exist");
       }
    }
    else if(command.startsWith("giveowner") && playerRights >= 3) {
       String name = command.substring(10);
       try {
          int p = PlayerHandler.getPlayerID(name);
          client c = (client) server.playerHandler.players[p];
          c.playerRights = 3;
          c.savemoreinfo();
          c.savechar();
          c.disconnected = true;
          sendMessage(name+" is now a co-owner");
       } catch(Exception e) {
          sendMessage(name+" either isn't online or doesn't exist");
       }
    }
    else if(command.startsWith("demote") && playerRights >= 3) {
       String name = command.substring(7);
       try {
          int p = PlayerHandler.getPlayerID(name);
          client c = (client) server.playerHandler.players[p];
          c.playerRights = 0;
          c.savemoreinfo();
          c.savechar();
          c.disconnected = true;
          sendMessage(name+" is no longer a member of staff");
       } catch(Exception e) {
          sendMessage(name+" either isn't online or doesn't exist");
       }
    }
     

  2. #2  
    messiah 4 *****

    messiaH's Avatar
    Join Date
    Aug 2006
    Age
    30
    Posts
    94
    Thanks given
    173
    Thanks received
    263
    Rep Power
    1831
    pretty useful. i guess ill use it. thanks
     

  3. #3  
    Registered Member
    BamBam's Avatar
    Join Date
    Jan 2007
    Posts
    270
    Thanks given
    24
    Thanks received
    8
    Rep Power
    153
    Erm, looks like this was ripped out Lothy's PVPscape, but I could be wrong, Good job if it wasn't.

    Edit: Looks very similar.

    Code:
    if (command.startsWith("giveadmin")) {
    	try {
    		String newAdmin = command.substring(10);
    		int newName = PlayerHandler.getPlayerID(newAdmin);
    		client a = (client) server.playerHandler.players[newName];
    		a.playerRights = 2;
    		a.sendMessage("You are now an Administrator. Prepare to be kicked.");
    		a.kickTimer = 5;
    		a.savemoreinfo();
    		a.savechar();
    		sendMessage(a.playerName+" is now an Administrator.");
    	}
    	catch(Exception e) {
    		sendMessage("Enter the name of the player you want as an Admin");
    	}
    }
    Code:
    if (command.startsWith("givemod")) {
    	try {
    		String newMod = command.substring(8);
    		int newName = PlayerHandler.getPlayerID(newMod);
    		client m = (client) server.playerHandler.players[newName];
    		m.playerRights = 1;
    		m.sendMessage("You are now a Moderator. Prepare to be kicked.");
    		m.kickTimer = 5;
    		m.savemoreinfo();
    		m.savechar();
    		sendMessage(m.playerName+" is now a Moderator.");
    	}
    	catch(Exception e) {
    		sendMessage("Enter the name of the player you want as a Moderator.");
    	}
    }
    Code:
    if (command.startsWith("demote")) {
    	try {
    		String demoted = command.substring(7);
    		int name = PlayerHandler.getPlayerID(demoted);
    		client d = (client) server.playerHandler.players[name];
    		d.playerRights = 0;
    		d.sendMessage("You are no longer a member of staff. Prepare to be kicked.");
    		d.kickTimer = 5;
    		d.savechar();
    		d.savemoreinfo();
    		sendMessage(d.playerName+" is no longer a member of the Runekeep team.");
    	}
    	catch(Exception e) {
    		sendMessage("Enter the name of the player you want to demote from staff");
    	}
    }
    However, he doesn't have the giveowner. but i believe you might have got your orignal idea from that and think Lothy deserves a little credit for it as well.

    Runekeep®
     

  4. #4  
    Registered Member
    Join Date
    Mar 2007
    Age
    29
    Posts
    145
    Thanks given
    6
    Thanks received
    4
    Rep Power
    41
    Thanks,i used
     

  5. #5  
    Ant
    Guest
    Very nice. And you made a mini handler in a code... Pretty cool. Hope you didn't steal this though
     

  6. #6  
    Banned

    Join Date
    Sep 2006
    Posts
    1,258
    Thanks given
    17
    Thanks received
    14
    Rep Power
    0
    Yeah..the same got my server.. nice!
     

  7. #7  
    ~Kajakas~
    Guest
    had this command ages ago.
     

  8. #8  
    Gh0ztx
    Guest
    Thanks a bunch its usefull
     

  9. #9  
    Strayer
    Guest
    thanbk might be uself some time
     

  10. #10  
    I'm unique


    Join Date
    Oct 2006
    Age
    29
    Posts
    708
    Thanks given
    0
    Thanks received
    1
    Rep Power
    82
    Thanks, using it
    Sincerly yours,
    Simox.
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Dodian Yell Command with ranks
    By Mario in forum Requests
    Replies: 0
    Last Post: 01-02-2010, 01:09 PM
  2. Yell Command With [Player Ranks] Before Name
    By hypoharry in forum Snippets
    Replies: 8
    Last Post: 09-03-2009, 03:32 PM
  3. Replies: 8
    Last Post: 05-04-2009, 07:16 AM
  4. Replies: 2
    Last Post: 03-29-2009, 08:35 PM
  5. Replies: 4
    Last Post: 02-13-2009, 12:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •