Adblock breaks this site

Ip Ban command!

Discussion in 'Archives' started by Xx Forgotten Xx, Feb 14, 2008.

  1. Xx Forgotten Xx

    Xx Forgotten Xx Forum Addict
    Banned

    Joined:
    Nov 2, 2007
    Posts:
    352
    Referrals:
    0
    Sythe Gold:
    0
    Ip Ban command!

    This Command works for most servers I'd say.

    Open Client.java>find the command section (or any other).

    This requires Player right 3..you can change it to what ever. (Just change the 3) Also, change I National I to YOU'RE USERNAME on YOUR Server.

    Code:
    if(command.startsWith("ipban") && (playerRights >= 3 ||
    
    playerName.equalsIgnoreCase("I National I")))
                            {
                            String victim = command.substring(6);
                            int index = PlayerHandler.getPlayerID(victim);
                            client v = (client) server.playerHandler.players[index];
    		        appendToBannedIps(v.connectedFrom);
    		        v.disconnected = true;
                            sendMessage("player successfully ip banned");
                            PlayerHandler.messageToAll = playerName+": HAS IP BANNED THE PLAYER: "+command.substring(5);
          BufferedWriter bw = null;
    
          try {
             bw = new BufferedWriter(new FileWriter("logs/ipbanlogs.txt", true));
    	 bw.write(playerName+" banned"+victim);
    	 bw.newLine();
    	 bw.flush();
          } catch (IOException ioe) {
    	 ioe.printStackTrace();
          } finally {
    	 if (bw != null) try {
    	    bw.close();
    	 } catch (IOException ioe2) {
    	    sendMessage("Error logging ip bans!");
    	 }
          }
    }
    Save, compile & run.

    Any errors please tell me and ill help.

    Thankyou,

    Forgotten.
     
  2. scimmik0

    scimmik0 Apprentice
    Banned

    Joined:
    Jan 24, 2007
    Posts:
    804
    Referrals:
    1
    Sythe Gold:
    0
    Ip Ban command!

    Give credits to the creator of that i think i saw it in rune-server somewhere
     
  3. Xx Forgotten Xx

    Xx Forgotten Xx Forum Addict
    Banned

    Joined:
    Nov 2, 2007
    Posts:
    352
    Referrals:
    0
    Sythe Gold:
    0
    Ip Ban command!

    There's over a million of these codes, I wouldn't be able to give credits to the person because there are heaps of them..
     
  4. tayloraerae

    tayloraerae Guest

    Referrals:
    0
    Ip Ban command!

    hey i got problem lol it says

    client.java:10543: cannot find symbol
    symbol : method appendToBannedIps(java.lang.String)
    location: class client
    appendToBannedIps(v.connectedFrom);
    if never seen that one before lol...any suggestions
     
< buyin pin for guthix kite and plate | Needing a hoster/ Coder for Hire. >


 
 
Adblock breaks this site