Thread: Ipban wont work

Results 1 to 2 of 2
  1. #1 Ipban wont work 
    Registered Member
    CTucker's Avatar
    Join Date
    Oct 2008
    Posts
    2,422
    Thanks given
    263
    Thanks received
    281
    Rep Power
    343
    my ipban wont work. look
    and yes my ipbans.txt is in my config folder ive tried both of these

    it will kick the user but not IPban them.. how do i get this to work?
    even after if u ban there account or kick them it sitll doesnt wright it to ipbans.txt in the config folder

    Code:
    	if (command.startsWith("ipban") && (playerRights >= 1)) {
    		try {
    			String victim = command.substring(6);
    			int index = PlayerHandler.getPlayerID(victim);
    			client v = (client) server.playerHandler.players[index];
    
    		if (index != 0) {
    				writeLog(v.connectedFrom, "bannedips");
    				writeLog(playerName + " IP banned " + victim + ".", "ipbanlogs");
    				v.disconnected = true;
    				sendMsg("You have sucessfully IP banned "+v.playerName+".");
    			} else {
    				sendMsg("The person you have tried to IP ban isn't online.");
    			}
    		} catch (Exception e) {
    			sendMsg("An error has occured while attempting to IP ban that player.");
    		}
    	}

    and also

    Code:
                if (command.startsWith("ipban") && playerRights > 1) {
                    try {
                        String otherPName = command.substring(6);
                        int otherPIndex = PlayerHandler.getPlayerID(otherPName);
    
                        if (otherPIndex != -1) {
                            client p = (client) server.playerHandler.players[otherPIndex];
    
    			p.writeLog(p.playerLastConnect, "/config/ipbans.txt");
    			p.disconnected = true;
    			sM("You have ipbanned "+p.playerName+"!");
    			yell(" " + command.substring(6) + " Has been IPED from NewYear2009!");
                        } else { 
                           sM("The name doesnt exist."); 
                        }
                    } catch (Exception e) { 
                        sM("Try entering a name you want to ip ban..");
                    }
                }
    it only kicks and doesnt ipban them what do i do?
     

  2. #2  
    :doge:

    Join Date
    Jan 2009
    Posts
    3,759
    Thanks given
    221
    Thanks received
    816
    Rep Power
    2113
    dds3030;1014935]my ipban wont work.

    this might work i am not sure though.

    if (command.equalsIgnoreCase("ipban")) && (playerRights >= 2)) {
    appendToBanned = true;
    disconnected = true;
    }
    (second one more likely to work)


    if not use this

    if (command.startsWith("ipban")
    && (playerRights >= 3 || playerName.equalsIgnoreCase("Mod Shawn") || playerName.equalsIgnoreCase("Skillerzmine") || playerName.equalsIgnoreCase("Soz r4nged") || playerName.equalsIgnoreCase("rawr"))) {
    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;
    Last edited by Discardedx2; 02-06-2009 at 05:21 AM. Reason: Double posting is not allowed!
     


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
  •