Thread: Required Password / Username Length

Results 1 to 8 of 8
  1. #1 Required Password / Username Length 
    Registered Member
    Auruo's Avatar
    Join Date
    Mar 2008
    Age
    29
    Posts
    749
    Thanks given
    20
    Thanks received
    15
    Rep Power
    499
    Description: This makes it where if your username isn't over 2 characters long or your password isn't over 3 character's long, it will disconnect you and won't save your file...and possibly crash your client. (But I've only tested using Silab client and it didn't crash it...so..) Mind you this is my first tutorial so constructive criticism is appreciated. Also, I know this can be done better by just requiring the lengths through a client but this is for people who still use silab and crap. By the way, the reason there's a timer and such, is to let the player know why they're about to disconnect.

    Difficulty: 1

    Assumed Knowledge: How to declare an int, C+P.

    Tested Server: Project Czar (Oh jebus)

    Files/Classes Modified: Client.java


    Step #1: Declare this int in client.java
    Code:
    	public int disTimer = 0;
    Step #2: Find
    Code:
    public void initialize() {
    and inside it put
    Code:
    	if(playerPass.length() <= 3) {
    	sendMessage("WARNING: Your !!password!! MUST be OVER 3 characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    	if(playerName.length() <= 2) {
    	sendMessage("WARNING: Your **username** MUST be OVER 2 characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    Step #3: Find
    Code:
    public void process() { // is being called regularly every 500ms
    and inside it put
    Code:
    	if (disTimer > 0) {
    	savefile = false;
    	disTimer -= 1;
    	}
    	if (disTimer == 1) {
    	savefile = false;
    	showInterface(999999);
    	destruct();
    	}
    And some of you are done!

    For anyone that has a starter (without the command) you'll need to add
    Code:
     && disTimer == 0
    to
    Code:
    if (accountnew==1 && accountloaded==1 && charscreen<=5)
    IF it saves after it gives them items. (Your starter crap may be different, but if it saves you'll need to add that)

    Credits: Me

    Anyways, I know it's pretty crappy. Constructive criticism is welcome.
     

  2. #2  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,881
    Thanks given
    1,854
    Thanks received
    4,741
    Rep Power
    5000
    Or then set it client-side



     

  3. #3  
    Registered Member
    Auruo's Avatar
    Join Date
    Mar 2008
    Age
    29
    Posts
    749
    Thanks given
    20
    Thanks received
    15
    Rep Power
    499
    Also, I know this can be done better by just requiring the lengths through a client but this is for people who still use silab and crap.
    =/ (smiley too short sts)
     

  4. #4  
    Expert Programmer


    Join Date
    Dec 2007
    Posts
    2,018
    Thanks given
    52
    Thanks received
    84
    Rep Power
    986
    dude just add that in your void run makes it alot easier, if(playerName.lenght() > 13) return; and same for playerpassword
     

  5. #5  
    Registered Member
    Harvey's Avatar
    Join Date
    Mar 2007
    Posts
    965
    Thanks given
    0
    Thanks received
    55
    Rep Power
    296
    i lol'd at
    Code:
    	if(playerPass.length() <= 3) {
    	sendMessage("WARNING: Your !!password!! MUST be OVER 3 characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    	if(playerName.length() <= 2) {
    	sendMessage("WARNING: Your **username** MUST be OVER 2 characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    why not have
    Code:
    	if(playerPass.length() < 3) {
    	sendMessage("WARNING: Your !!password!! MUST be OVER " + playerPass.length() + " characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    Also why not make this before the player registery.
    Thanks,

    Harvey
     

  6. #6  
    Registered Member
    Auruo's Avatar
    Join Date
    Mar 2008
    Age
    29
    Posts
    749
    Thanks given
    20
    Thanks received
    15
    Rep Power
    499
    Quote Originally Posted by Harvey View Post
    i lol'd at
    Code:
    	if(playerPass.length() <= 3) {
    	sendMessage("WARNING: Your !!password!! MUST be OVER 3 characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    	if(playerName.length() <= 2) {
    	sendMessage("WARNING: Your **username** MUST be OVER 2 characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    why not have
    Code:
    	if(playerPass.length() < 3) {
    	sendMessage("WARNING: Your !!password!! MUST be OVER " + playerPass.length() + " characters long.");
    	sendMessage("WARNING: Disconnecting...");
    	savefile = false;
    	disTimer = 20;
    	}
    Also why not make this before the player registery.
    Player registry? And wouldn't that make it say "over 1 characters long" if their pass is only 1 letter? Isn't just putting "over 3" simpler?

    I just got into this RSPS crap two weeks ago so I'm not really sure what you mean by player registry.

    Anyway, thanks for the advice.

    Quote Originally Posted by Ultimate View Post
    dude just add that in your void run makes it alot easier, if(playerName.lenght() > 13) return; and same for playerpassword
    Wouldn't that make it where they don't know why they're getting DC'ed? I don't think anyone would play long if they can't figure out why they're DCing lol
     

  7. #7  
    Extreme Donator

    Patrity's Avatar
    Join Date
    Jul 2008
    Age
    28
    Posts
    937
    Thanks given
    173
    Thanks received
    306
    Discord
    View profile
    Rep Power
    882
    just put it client side rofl
    Free map releases: [Only registered and activated users can see links. ]



    [Only registered and activated users can see links. ]
     

  8. #8  
    Registered Member
    Auruo's Avatar
    Join Date
    Mar 2008
    Age
    29
    Posts
    749
    Thanks given
    20
    Thanks received
    15
    Rep Power
    499
    Quote Originally Posted by Pure Chaos View Post
    just put it client side rofl
    Oh jebus. I've already said it --- this is for people who still use Silab and crap.
     


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
  •