Ip Ban command!

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

Ip Ban command!
  1. Unread #1 - Feb 14, 2008 at 3:12 AM
  2. Xx Forgotten Xx
    Joined:
    Nov 2, 2007
    Posts:
    352
    Referrals:
    0
    Sythe Gold:
    0

    Xx Forgotten Xx Forum Addict
    Banned

    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.
     
  3. Unread #2 - Feb 14, 2008 at 4:09 PM
  4. scimmik0
    Joined:
    Jan 24, 2007
    Posts:
    804
    Referrals:
    1
    Sythe Gold:
    0

    scimmik0 Apprentice
    Banned

    Ip Ban command!

    Give credits to the creator of that i think i saw it in rune-server somewhere
     
  5. Unread #3 - Feb 15, 2008 at 12:23 AM
  6. Xx Forgotten Xx
    Joined:
    Nov 2, 2007
    Posts:
    352
    Referrals:
    0
    Sythe Gold:
    0

    Xx Forgotten Xx Forum Addict
    Banned

    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..
     
  7. Unread #4 - Feb 16, 2008 at 1:07 AM
  8. tayloraerae
    Referrals:
    0

    tayloraerae Guest

    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. >

Users viewing this thread
1 guest


 
 
Adblock breaks this site