Thread: [pi] Giverank commands

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [pi] Giverank commands 
    Registered Member
    Join Date
    Sep 2011
    Posts
    112
    Thanks given
    0
    Thanks received
    1
    Rep Power
    18
    Code:
    	if (playerCommand.startsWith("givemod")  && c.playerName.equalsIgnoreCase("edwd9")) {
    				try {	
    					String playerToMod = playerCommand.substring(8);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
    								Client c2 = (Client)Server.playerHandler.players[i];
    								c2.sendMessage("You have been given mod status by "+ c.playerName +"");
    								c.sendMessage("You have givein mod to "+c2.playerName+"");
    								c2.playerRights = 5;
    								c2.logout();
    								break;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    Code:
        if (playerCommand.startsWith("giveedonator") && c.playerName.equalsIgnoreCase("edwd9")) {
    				try {	
    					String playerToeDonator = playerCommand.substring(7);
    					for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    						if(Server.playerHandler.players[i] != null) {
    							if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToeDonator)) {
    								Client c2 = (Client)Server.playerHandler.players[i];
    								c2.sendMessage("You have been given extreme donator status by " + c.playerName);
    								c2.playerRights = 4;
    								c2.logout();
    								break;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    why does it work for mod, but not my edonator ??? please help and explain
    Reply With Quote  
     

  2. #2  
    Member [pi] Giverank commands Market Banned

    thesharp's Avatar
    Join Date
    Dec 2010
    Age
    32
    Posts
    1,118
    Thanks given
    311
    Thanks received
    140
    Rep Power
    312
    String playerToeDonator = playerCommand.substring("giveedonator ".length());
    since "giveedonator " is NOT 7 characters long.



    Reply With Quote  
     

  3. #3  
    Legit Rank
    Bermuda's Avatar
    Join Date
    Aug 2009
    Posts
    1,463
    Thanks given
    380
    Thanks received
    298
    Rep Power
    2320
    Quote Originally Posted by LogiCScape View Post
    why does it work for mod, but not my edonator ??? please help and explain
    Should it not just be "playerToDonator' ?
    Attached image
    Reply With Quote  
     

  4. #4  
    єχтяємє яαт

    Zombie's Avatar
    Join Date
    Sep 2009
    Posts
    314
    Thanks given
    102
    Thanks received
    100
    Rep Power
    3862
    playerTOEdonator

    Attached image
    Attached image

    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Sep 2011
    Posts
    112
    Thanks given
    0
    Thanks received
    1
    Rep Power
    18
    Quote Originally Posted by Post-Hardcore. View Post
    Should it not just be "playerToDonator' ?
    no edonator = Extreme donator
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Sep 2011
    Posts
    112
    Thanks given
    0
    Thanks received
    1
    Rep Power
    18
    Quote Originally Posted by I F A I L View Post
    playerTOEdonator
    no...
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Sep 2011
    Posts
    112
    Thanks given
    0
    Thanks received
    1
    Rep Power
    18
    Quote Originally Posted by thesharp View Post
    String playerToeDonator = playerCommand.substring("giveedonator ".length());
    since "giveedonator " is NOT 7 characters long.

    thak you i was lookin for that the number after it means.. but

    "givemod" = 7 characters long

    but
    String playerToMod = playerCommand.substring(8);
    works
    2 you
    Reply With Quote  
     

  8. #8  
    Member [pi] Giverank commands Market Banned

    thesharp's Avatar
    Join Date
    Dec 2010
    Age
    32
    Posts
    1,118
    Thanks given
    311
    Thanks received
    140
    Rep Power
    312
    Quote Originally Posted by LogiCScape View Post
    thak you i was lookin for that the number after it means.. but

    "givemod" = 7 characters long

    but
    String playerToMod = playerCommand.substring(8);
    works
    2 you
    I even said "giveedonator (space)" since you put a space in between command and the name.

    Perhaps go learn the basics of Java before you code a server.
    Code:
    substring
    
    public String substring(int beginIndex)
    Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.
    Examples:
    
     "unhappy".substring(2) returns "happy"
     "Harbison".substring(3) returns "bison"
     "emptiness".substring(9) returns "" (an empty string)
     
    Parameters:
    beginIndex - the beginning index, inclusive.
    Returns:
    the specified substring.
    Throws:
    IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object.
    src: String (Java Platform SE 6))


    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Sep 2011
    Posts
    112
    Thanks given
    0
    Thanks received
    1
    Rep Power
    18
    Quote Originally Posted by thesharp View Post
    I even said "giveedonator (space)" since you put a space in between command and the name.

    Perhaps go learn the basics of Java before you code a server.
    Code:
    substring
    
    public String substring(int beginIndex)
    Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string.
    Examples:
    
     "unhappy".substring(2) returns "happy"
     "Harbison".substring(3) returns "bison"
     "emptiness".substring(9) returns "" (an empty string)
     
    Parameters:
    beginIndex - the beginning index, inclusive.
    Returns:
    the specified substring.
    Throws:
    IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object.
    src: String (Java Platform SE 6))

    well fuck you too? i cant see spaces on here.. "giveedonator " at reading it 1st u cant see the space
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Sep 2011
    Posts
    112
    Thanks given
    0
    Thanks received
    1
    Rep Power
    18
    btw rep++ 4 u thanks for wasting time helping me
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 2
    Last Post: 06-07-2011, 08:29 PM
  2. Replies: 9
    Last Post: 11-28-2009, 05:39 AM
  3. Sell Commands / Buy Commands
    By 5simple5 in forum Help
    Replies: 5
    Last Post: 01-17-2009, 06:03 PM
  4. Replies: 19
    Last Post: 11-23-2008, 05:30 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •