Saturday, 2024-04-27, 5:49 PM
CoolerScape
Welcome Guest | RSS
Main | how to stop Bots for good - Forum | Registration | Login
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » RS2 Server » Tutorials » how to stop Bots for good
how to stop Bots for good
shockzDate: Wednesday, 2008-09-24, 9:06 PM | Message # 1
Man/Woman
Group: Administrator
Messages: 16
Reputation: 1
Status: Member is Offline
Description: To automaticly IP-BAN ANYBODY who try's to login with an syi username, Thus eleminating server crashers before they can crash. YOU DONT EVEN NEED TO RESTART OR LOGOUT.

Difficulty: 2

Assumed Knowledge: Copy and paste

Tested Server: shockerscape

Files/Classes Modified: Client, and make file called SYI-IP.txt and place in logs folder

Procedure
Step 1: creating the files and placing them correctly
Ok if you do not have the folder "logs" in your server's folder, create it. Now open a NEW notepad and just do File -> Save As -> name it
Code:

Code
SYI-IP

and make sure you save it into your "logs" folder as a .txt file

Step 2: Placing what you need in client.java
first go to your process and add

Code:

Code
if (playerName.contains("SYI")) {
        BufferedWriter bw = null;
try {
           bw = new BufferedWriter(new FileWriter("logs/SYI-IP.txt", true));
    bw.write(connectedFrom);
    bw.newLine();
    bw.flush();
   disconnected = true;
        } catch (IOException ioe) {
    ioe.printStackTrace();
        } finally {
    if (bw != null) try {
       bw.close();
    } catch (IOException ioe2) {
       sendMessage("Error logging SYI-IP");
    }
        }
        }

Step 3: Making it actually ip ban them and not just catch there ip
find
Code:

Code
public int checkbannedusers()

(if you cannot find it, find the int that stops people from logging in if they are banned) and add:

Code:

Code
public int checkbannedSYI()
   {
    try
    {
     BufferedReader in = new BufferedReader(new FileReader("logs/SYI-IP.txt"));
     String data = null;
     while ((data = in.readLine()) != null)
     {
      if (connectedFrom.equalsIgnoreCase(data))
      {
       return 5;
      }
     }
    }
    catch (IOException e)
    {
     System.out.println("Critical error while checking banned SYI!");
     e.printStackTrace();
    }
    return 0;
   }
 
shockzDate: Wednesday, 2008-09-24, 9:07 PM | Message # 2
Man/Woman
Group: Administrator
Messages: 16
Reputation: 1
Status: Member is Offline
Continued:

step 4: placing this int
find in client.java

Code:

Code
public void run()

and down in it where it says stuff like this

Code:

Code
checkbannedusers();
checkbannedips();

Code
if(checkbannedusers() == 5) {
   returnCode = 4;
   System.out.println(playerName+" failed to logon because they are banned.");
   appendToLR(playerName+" failed to logon because they are banned.");
   savefile = false;
   disconnected = true;
}

add these two things in the correct places

Code:

Code
checkbannedSYI();

and finally the last bit:

Code:

Code
if(checkbannedSYI() == 5) {
   returnCode = 4;
   System.out.println(playerName+" failed to logon because their ip is banned.");
   appendToLR(playerName+" failed to logon because their ip is banned.");
   savefile = false;
   disconnected = true;
}

Save + compile + run

i added this to my server and i already stoped 5 people sending SYI's in biggrin

the thing is is that u need to copy and paste:
but instead of SYI put ~ or syi or _ anything like that to stop them from loging in and if u want them to just be a banned user instead of:

Code
  bw.write(connectedFrom);

Put:
Code
    bw.write(playerName);
 
shockzDate: Wednesday, 2008-09-24, 9:07 PM | Message # 3
Man/Woman
Group: Administrator
Messages: 16
Reputation: 1
Status: Member is Offline
Continued:

and if u want it to go to banneduser.txt just add :

Code
         bw = new BufferedWriter(new FileWriter("data/bannedusers.txt", true));

instead of:
Code
         bw = new BufferedWriter(new FileWriter("logs/SYI-IP.txt", true));

Code
if (playerName.contains("SYI")) {
       BufferedWriter bw = null;
try {
          bw = new BufferedWriter(new FileWriter("logs/SYI-IP.txt", true));
   bw.write(connectedFrom);
   bw.newLine();
   bw.flush();
  disconnected = true;
       } catch (IOException ioe) {
   ioe.printStackTrace();
       } finally {
   if (bw != null) try {
      bw.close();
   } catch (IOException ioe2) {
      sendMessage("Error logging SYI-IP");
   }
       }
       }
 
mosselDate: Tuesday, 2009-02-03, 0:16 AM | Message # 4
Man/Woman
Group: Member
Messages: 6
Reputation: -1
Status: Member is Offline
ai hope its work cool
 
v0idpkzDate: Sunday, 2009-02-08, 6:55 PM | Message # 5
Man/Woman
Group: Member
Messages: 3
Reputation: 0
Status: Member is Offline
good luck wacko
 
Forum » RS2 Server » Tutorials » how to stop Bots for good
  • Page 1 of 1
  • 1
Search:

Copyright MyCorp © 2024 Powered by uCoz