Thread: Ban for mods and admins

Results 1 to 8 of 8
  1. #1 Ban for mods and admins 
    Registered Member
    Enjoi's Avatar
    Join Date
    Sep 2008
    Posts
    2,454
    Thanks given
    565
    Thanks received
    281
    Rep Power
    1325
    Ok so i know a ton of people obviously have used Pixel's Ban tutorial. And in it the code looks like this.

    Code:
    if (cmd[0].equals("banuser") && p.username.equalsIgnoreCase("Simon")) {
    If you use this, then all mods/admins can use it

    I know this is simple, but i hope it helps people who are somewhat confused by it.



    Code:
                if (p.rights >= 1) {}
                if (p.rights >= 2) {
    if (cmd[0].equals("unban")) {
    String Name2UnBan = playerCommand.substring(6);
    p.UnBanPlayer(Name2UnBan);
    p.frames.sendMessage(p, "You have just UnBanned "+playerCommand.substring(6));
    BufferedWriter bw = null;
    p.updateReq = true;
    p.appearanceUpdateReq = true;
    }
    if (cmd[0].equals("banuser")) {
    String victim = playerCommand.substring((playerCommand.indexOf(" ") + 1));
    Player p2 = Engine.players[Engine.getIdFromName(victim)];
    if (p2 != null) {
    p.frames.sendMessage(p, "You have just Banned " + p2.username+"!");
    p2.appendToBanned(victim);
    Server.loadBannedUsers();
    p2.disconnected[0] = true;
    BufferedWriter bw = null;
    p.updateReq = true;
    p.appearanceUpdateReq = true;
    }
    }
    Reply With Quote  
     

  2. #2  
    Sexy Donator
    Downfall's Avatar
    Join Date
    Oct 2008
    Age
    26
    Posts
    1,084
    Thanks given
    10
    Thanks received
    1
    Rep Power
    393
    Huh lolz so what does this do make it for all admins and mods???

    and if it is could you make it so its like this...

    if (cmd[0].equals("unban") && (p.rights <= 1)) {

    [Only registered and activated users can see links. ]
    Did you know?
    - JaGeX has enough money to buy 8,000,000 tons of SuperCrack.
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Jan 2008
    Posts
    2,345
    Thanks given
    20
    Thanks received
    575
    Rep Power
    1202
    PLS CONVENTIONS I BEG U

    Code:
    	if (cmd[0].equals("unban")) {
    		String Name2UnBan = playerCommand.substring(6);
    		p.UnBanPlayer(Name2UnBan);
    		p.frames.sendMessage(p, "You have just unb& "+playerCommand.substring(6));
    		BufferedWriter bw = null;
    	}
    	if (cmd[0].equals("banuser")) {
    		String victim = playerCommand.substring((playerCommand.indexOf(" ") + 1));
    		Player client2 = Engine.players[Engine.getIdFromName(victim)];
    			if (client2 != null) {
    				p.frames.sendMessage(p, "You have just b& " + client2.username+"!");
    				client2.appendToBanned(victim);
    				Server.loadBannedUsers();
    				BufferedWriter bw = null;
    				client2.disconnected[0] = true;
    			}
    	}
    Reply With Quote  
     

  4. #4  
    Registered Member
    Enjoi's Avatar
    Join Date
    Sep 2008
    Posts
    2,454
    Thanks given
    565
    Thanks received
    281
    Rep Power
    1325
    Sorry michael, i know you prefer conventions i havent really learned then yet, and i wrote this up quickly
    Reply With Quote  
     

  5. #5  
    Gfx/Coder


    Join Date
    Dec 2008
    Posts
    1,965
    Thanks given
    38
    Thanks received
    48
    Rep Power
    320
    Quote Originally Posted by Pl0x0rz View Post
    Sorry michael, i know you prefer conventions i havent really learned then yet, and i wrote this up quickly

    Idc how dumb this makes me but wtf are conventions im kinda new to coding so you know.
    Reply With Quote  
     

  6. #6  
    Sexy Donator
    Downfall's Avatar
    Join Date
    Oct 2008
    Age
    26
    Posts
    1,084
    Thanks given
    10
    Thanks received
    1
    Rep Power
    393
    It makes the code eazier to read so if u Dont have alot of conventions ur .java file will start to look like a 500- Client.java file lol and it makes it proform better

    [Only registered and activated users can see links. ]
    Did you know?
    - JaGeX has enough money to buy 8,000,000 tons of SuperCrack.
    Reply With Quote  
     

  7. #7  
    Donator

    iZAjz's Avatar
    Join Date
    Mar 2007
    Age
    26
    Posts
    3,675
    Thanks given
    105
    Thanks received
    47
    Rep Power
    1882
    Quote Originally Posted by Xx Downfall xX View Post
    It makes the code eazier to read so if u Dont have alot of conventions ur .java file will start to look like a 500- Client.java file lol and it makes it proform better
    True, altough the main reason of conventions are a bit different.

    But it DOES make your code easier to read
    Reply With Quote  
     

  8. #8  
    Gfx/Coder


    Join Date
    Dec 2008
    Posts
    1,965
    Thanks given
    38
    Thanks received
    48
    Rep Power
    320
    O ok thx for letting me kno
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •