Thread: command

Results 1 to 3 of 3
  1. #1 command 
    Registered Member
    Join Date
    Nov 2009
    Posts
    519
    Thanks given
    135
    Thanks received
    10
    Rep Power
    32
    I add this command and when i compile it gives me error please help tell me whats wrong with this command...


    if (playerCommand.startsWith("givemod")) {
    try {
    String playerToMod = playerCommand.substring(8);
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(PlayerHandler.players[i] != null) {
    if(PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToMod)) {
    Client c2 = (Client)PlayerHandler.players[i];
    c2.sendMessage("You have been given mod status by " + c.playerName);
    c2.playerRights = 1;
    c2.isDonator = false;
    c2.logout();
    break;
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player must be offline, or they don't exist.");
    }
    }
    Reply With Quote  
     

  2. #2  
    GANGNAM STYLE!

    Ohad's Avatar
    Join Date
    Aug 2011
    Posts
    3,179
    Thanks given
    152
    Thanks received
    352
    Rep Power
    1671
    maybe post the errors?
    Reply With Quote  
     

  3. #3  
    Registered Member ARshadow's Avatar
    Join Date
    Aug 2011
    Posts
    470
    Thanks given
    30
    Thanks received
    41
    Rep Power
    53
    Post the errors...

    Code:
    if (playerCommand.startsWith("givemod")) {
    				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);
    								c2.playerRights = 1;
    								c2.logout();
    								break;
    							} 
    						}
    					}
    				} catch(Exception e) {
    					c.sendMessage("Player Must Be Offline.");
    				}			
    			}
    I found that on my old source, should work.

    Edit: That's the same thing, lol. Just neater - nvm. We can only help if you tell us the error.
    Spoiler for Vouches:
    Quote Originally Posted by Liam Baby
    Vouch
    Quote Originally Posted by Mojo!
    vouch for adding killstreak system to my server
    Quote Originally Posted by jet kai
    Vouch for buying 28m of me, very fast, no hassle and trusted.
    All these vouches are on my profile, I just put it into quotes and in my signature to make it easier for users to find .
    Reply With Quote  
     


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: 50
    Last Post: 04-17-2014, 02:19 PM
  2. Replies: 4
    Last Post: 12-21-2010, 09:36 PM
  3. Replies: 4
    Last Post: 12-19-2010, 11:46 PM
  4. Replies: 4
    Last Post: 02-13-2009, 12:32 AM
  5. Replies: 1
    Last Post: 08-16-2008, 04:05 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •