Thread: Logout timer

Results 1 to 5 of 5
  1. #1 Logout timer 
    lefon
    Guest
    Can any 1 post me a working log out timer, i need to fix the way of duplicate
    Need to LOG OUT Timer it must say you cannot log out in combat smth like this please help
    Reply With Quote  
     

  2. #2  
    lefon
    Guest
    Any?
    Reply With Quote  
     

  3. #3  
    Registered Member
    .Dan's Avatar
    Join Date
    Sep 2008
    Age
    28
    Posts
    873
    Thanks given
    54
    Thanks received
    115
    Rep Power
    494
    Something like:
    Code:
    if (!p.inCombat() && p.combatTimer == 0) {
    p.logOut(); 
    } else {
    p.sendMessage("you are in combat! wait " + p.combatTimer + " seconds to log out");
    }
    Ik, the code is messy, I wrote it here, on forums.
    Reply With Quote  
     

  4. #4  
    Registered Member Deathfire138's Avatar
    Join Date
    Aug 2009
    Posts
    175
    Thanks given
    26
    Thanks received
    16
    Rep Power
    57
    Well, the timer itself is actually a packet, but you can use his code for implementation in the packet.



    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Jun 2008
    Posts
    913
    Thanks given
    30
    Thanks received
    94
    Rep Power
    0
    Declare this:
    Code:
    /**
     * The last time that the player was hit in combat.
     */
    public long lastHitTime;
    Then, in your combat method, when you get hit add:
    Code:
    lastHitTime = System.currentTimeMillis();
    Then in your logout method, at the top, add:
    Code:
    if (System.currentTimeMillis() - lastHitTime < 10000) {
            sendMessage("You must be out of combat for 10 seconds to log out.");
            return;
    }
    That will make it so that you cannot log out without being out of combat for 10 seconds.
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •