Thread: Fuuuuuuuu! Command problem!

Results 1 to 3 of 3
  1. #1 Fuuuuuuuu! Command problem! 
    Donator


    Join Date
    Sep 2008
    Age
    30
    Posts
    397
    Thanks given
    138
    Thanks received
    27
    Rep Power
    161
    Okay, it's not often that I come here anymore for help unless I need it. And, as ironic as it is, it's for a command to request help from the staff. Go figure. Anywho, I don't come asking for help unless I'm really stuck and have no fucking clue as to how to fix something. I try to work it as best of my knowledge, but this one stumps me..

    Code:
    if(playerCommand.equalsIgnoreCase("help") && System.currentTimeMillis() - c.lastHelp >= 30000) {
    					c.sendMessage("All online staff have been notified of your request. You should be contacted shortly.");
                        c.lastHelp = System.currentTimeMillis();
                        for (int i = 0; i < Server.playerHandler.players.length; i++) {
                            if (Server.playerHandler.players[i] != null) {
    							Client c2 = (Client)Server.playerHandler.players[i];
                                if((c2.playerRights >= 1 && c2.playerRights <= 3) || (c2.playerRights == 7)){
    								c2.sendMessage("[<col=17390><img=2>HELP MESSAGE</col>]<col=17390>"+Misc.optimizeText(c.playerName)+"</col> needs help. Coordinates are:<col=17390>"+c.absX+", "+c.absY+"</col>.");
                                 }
                            }
    					}
                    } else if (System.currentTimeMillis() - c.lastHelp < 30000) {
                        c.sendMessage("You can only use this command once every 30 seconds!");
                    }
                }
    There's my current help command. May be ugly, idgaf, but I need it to work. It does! Somewhat... However, whenever you use another command, it sends the help message again. The brackets are correct, but I have no idea what is going on. I realized that if I use the command without the timer, it works perfectly fine. However, with the timer added, it's fucked up.

    Help, please? Will Rep + thank.




    ---


    Lawl! ^ ^
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Nov 2009
    Posts
    46
    Thanks given
    6
    Thanks received
    7
    Rep Power
    1
    Generally people only come to the help thread when they can't figure it out for themselves, nice intro though


    Code:
    		if(playerCommand.equalsIgnoreCase("help")) {
                    if (System.currentTimeMillis() - c.lastHelp < 30000) {
                        c.sendMessage("You can only use this command once every 30 seconds!");
                    }
                        for (int i = 0; i < Server.playerHandler.players.length; i++) {
                            if (Server.playerHandler.players[i] != null) {
    							Client c2 = (Client)Server.playerHandler.players[i];
                                if((c2.playerRights >= 1 && c2.playerRights <= 3) || (c2.playerRights == 7)){
    								c.sendMessage("All online staff have been notified of your request. You should be contacted shortly.");
                      						c.lastHelp = System.currentTimeMillis();
    								c2.sendMessage("[<col=17390><img=2>HELP MESSAGE</col>]<col=17390>"+Misc.optimizeText(c.playerName)+"</col> needs help. Coordinates are:<col=17390>"+c.absX+", "+c.absY+"</col>.");
                                 }
                            }
    					}
                	}
    Quoting me works best because I delete my replies once I hit 50 posts. Gotta stay a bronze pro
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Donator


    Join Date
    Sep 2008
    Age
    30
    Posts
    397
    Thanks given
    138
    Thanks received
    27
    Rep Power
    161
    Quote Originally Posted by Bronze Pro View Post
    Generally people only come to the help thread when they can't figure it out for themselves, nice intro though


    Code:
    		if(playerCommand.equalsIgnoreCase("help")) {
                    if (System.currentTimeMillis() - c.lastHelp < 30000) {
                        c.sendMessage("You can only use this command once every 30 seconds!");
                    }
                        for (int i = 0; i < Server.playerHandler.players.length; i++) {
                            if (Server.playerHandler.players[i] != null) {
    							Client c2 = (Client)Server.playerHandler.players[i];
                                if((c2.playerRights >= 1 && c2.playerRights <= 3) || (c2.playerRights == 7)){
    								c.sendMessage("All online staff have been notified of your request. You should be contacted shortly.");
                      						c.lastHelp = System.currentTimeMillis();
    								c2.sendMessage("[<col=17390><img=2>HELP MESSAGE</col>]<col=17390>"+Misc.optimizeText(c.playerName)+"</col> needs help. Coordinates are:<col=17390>"+c.absX+", "+c.absY+"</col>.");
                                 }
                            }
    					}
                	}
    Close.... Now the timer doesn't work, and it sends the "All online staff have been notified...." message twice. Thanks, though.

    EDIT: I changed it around a slight bit, and it works perfectly now. Thanks for the help!




    ---


    Lawl! ^ ^
    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. [iClarity] My Jail Command Problem
    By Zetux in forum Help
    Replies: 3
    Last Post: 09-26-2009, 03:41 PM
  2. Command problems hard to explain.
    By P A N I C in forum Help
    Replies: 12
    Last Post: 07-16-2009, 09:09 PM
  3. ::char command problems
    By giggadude in forum Help
    Replies: 11
    Last Post: 07-13-2009, 11:18 PM
  4. command problem on delta
    By d34d pk3r in forum Requests
    Replies: 4
    Last Post: 04-01-2009, 02:04 AM
  5. Command Problem
    By Chachi in forum Help
    Replies: 10
    Last Post: 02-08-2009, 06:37 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
  •