Zunescape
November 23, 2009, 07:23:33 am
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Server is currently under construction. Will be up soon =D
 
  Home Help Search Gallery Staff List Login Register  

make ur server anti crash


Pages: [1]   Go Down
  Print  
Author Topic: make ur server anti crash  (Read 72 times)
0 Members and 1 Guest are viewing this topic.
mod 0wn4g3
Guest
« on: June 23, 2007, 05:13:48 am »

Purpose: To stop the noobs that crash servers for fun.

Difficulty: 1/10 (took me 2 days to make  :mad: because i dont have that much free time)

Assumed Knowledge: how to open up your java files and compile it.

Server Base: Any (post if yours does not work)

Classes Modified: server.java

Procedure

Step 1:
Find " if (Found < 3) { " and under it delete

Quote
playerHandler.newPlayerClient(s, connectingHost);
Step 2:
Add this code to your server.java file under " if (Found < 3) { ".
Quote
   //multi login code                  
   for(int z = 0; z < Foundz; z++) {
      int y = z+1;
      if(connectingHost.startsWith(Connections[y]+"") ){//Connected
   misc.println("ClientHandler: Rejected "+connectingHost+":"+s.getPort());
   s.close(); //close port
   break;
   
   }else{
         if(z < Foundz){ //at the end of the for loop run this
            Foundz++;//adds 1 for next player
            z++; //adds1 to save string to next aray
            Connections[z] = connectingHost;
   System.out.println("ClientHandler: Accepted Connection Fully");
 playerHandler.newPlayerClient(s, connectingHost); //logs player in
 break; //ends for loop
}
   }
         }
Step 3:

Add this int to your file.
Quote
public static int Foundz = 1;
public static int resetplayz;
Step 4:
Under "if(updateServer)" add
Quote
   if(resetplayz >= 30){ // resets the players that logged in about ever 15 secconds
   
   for(int i = 0; i < 300; i++) { //run about 300 times i dont think we are going to get 300 connections in 15 secconds
   Connections = null;// reset
      
         
   }
      resetplayz = 0;
   }else{
      resetplayz++;
   }
Report Spam   Logged
js53
Guest
« Reply #1 on: June 24, 2007, 03:23:08 pm »

nice, good job.  >Cheesy
Report Spam   Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2006, Simple Machines LLC
ServerBeach Coupon