Thread: [PI] Work out when AFK

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36
  1. #1 [PI] Work out when AFK 
    Donator

    Join Date
    Feb 2013
    Posts
    1,670
    Thanks given
    477
    Thanks received
    244
    Rep Power
    29
    Tired of AFK players just standing at home?
    This is a small snippet that will make the player: do push ups, sit ups, star jumps and jog on the place when AFK.

    Simple enough, just replace your IdleLogout (server.model.players.packets) class with this:
    Code:
    public class IdleLogout implements PacketType {
    	
    	int[] emotes = {2756, 2761, 2763, 2764};
    	
    	@Override
    	public void processPacket(Client c, int packetType, int packetSize) {
    		if (c.membership) {
    			
    			c.startAnimation(emotes[Misc.random((emotes.length - 1))]);
    			
    		}
    	}
    }
    If you don't have a boolean called "membership" or just want all players to do this, use this:

    Code:
    public class IdleLogout implements PacketType {
    	
    	int[] emotes = {2756, 2761, 2763, 2764};
    	
    	@Override
    	public void processPacket(Client c, int packetType, int packetSize) {
    		//if (c.membership) {
    			
    			c.startAnimation(emotes[Misc.random((emotes.length - 1))]);
    			
    		//}
    	}
    }

    Quote Originally Posted by Verisimilitude View Post
    Not to be a smart ass or anything, but I think you forgot to tell them to import this

    Code:
    import core.utility.Misc;
    or wherever they place the file at.



    Reply With Quote  
     


  2. #2  
    Registered Member
    Shoutbox's Avatar
    Join Date
    Sep 2013
    Posts
    1,748
    Thanks given
    580
    Thanks received
    363
    Rep Power
    834
    For the lols
    S A D B O Y S

    私は自分自身を殺すために待つことができない
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Aug 2007
    Posts
    4,130
    Thanks given
    0
    Thanks received
    64
    Rep Power
    0
    Lol simple but nice.
    Reply With Quote  
     

  4. Thankful users:


  5. #4  
    2021
    SoulSplit's Avatar
    Join Date
    Nov 2011
    Posts
    830
    Thanks given
    620
    Thanks received
    654
    Rep Power
    528
    You know you're lazy when you make your game-character work out
    Reply With Quote  
     

  6. Thankful users:


  7. #5  
    Registered Member

    Join Date
    Dec 2013
    Posts
    387
    Thanks given
    43
    Thanks received
    72
    Rep Power
    190
    Nice idea.

    How many minutes does it take for it to start performing the emotes?
    Reply With Quote  
     

  8. #6  
    Donator

    Join Date
    Feb 2013
    Posts
    1,670
    Thanks given
    477
    Thanks received
    244
    Rep Power
    29
    Quote Originally Posted by Lewy View Post
    Nice idea.

    How many minutes does it take for it to start performing the emotes?
    Not sure, about a minute.
    Reply With Quote  
     

  9. #7  
    Theory Wins?
    Greyfield's Avatar
    Join Date
    Nov 2008
    Age
    32
    Posts
    1,585
    Thanks given
    61
    Thanks received
    265
    Rep Power
    310
    Haha you put other use to the idle packet. And I think the idle packet sends flags every x amount of time iirc. The first I believe is 1.30 minutes.



    Reply With Quote  
     

  10. #8  
    Registered Member
    Join Date
    Dec 2010
    Posts
    354
    Thanks given
    17
    Thanks received
    61
    Rep Power
    47
    Try using a switch here or maybe an array of emotes

    Code:
    private static final int[] IDLE_EMOTES = {2500, 2699};
    And than just do
    Code:
    c.startAnimation(IDLE_EMOTES[random.nextInt(IDLE_EMOTES.length)]);
    May be a bit off did that in chat box other than that the idea is cool
    Reply With Quote  
     

  11. #9  
    Donator

    Join Date
    Feb 2013
    Posts
    1,670
    Thanks given
    477
    Thanks received
    244
    Rep Power
    29
    Quote Originally Posted by dan0194 View Post
    Try using a switch here or maybe an array of emotes

    Code:
    private static final int[] IDLE_EMOTES = {2500, 2699};
    And than just do
    Code:
    c.startAnimation(IDLE_EMOTES[random.nextInt(IDLE_EMOTES.length)]);
    May be a bit off did that in chat box other than that the idea is cool
    Thank you.
    My Java knowledge is very limited.
    Reply With Quote  
     

  12. #10  
    🍕

    Linus's Avatar
    Join Date
    Dec 2008
    Age
    31
    Posts
    2,779
    Thanks given
    974
    Thanks received
    411
    Rep Power
    0
    Guessin this would work too
    Code:
    //variable = (condition) ? true-value : false-value;
    c.startAnimation((Misc.random(4) == 0) ? 2756 : 2760+Misc.random(4));

    ╠╬╣
    ╦╦
    ╠╬╬╬╣
    ╠╬╬╬╬╬╬╣
    ╠╬╬╬╬╬╬╣
    ╚╩╩╩╩╩╩╝

    ╠╬╬╬╣



    Reply With Quote  
     

  13. Thankful user:


Page 1 of 4 123 ... 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. [PI] Weird out print when players log in
    By Ambient in forum Help
    Replies: 7
    Last Post: 02-07-2012, 06:14 AM
  2. Replies: 7
    Last Post: 10-07-2011, 04:59 AM
  3. [pi] Stop fighting when out of wild
    By ItsGoml in forum Help
    Replies: 6
    Last Post: 10-04-2011, 10:29 PM
  4. PI Quest restarts when u log out.
    By Kaiser Btw in forum Help
    Replies: 1
    Last Post: 04-11-2011, 10:03 AM
  5. [PI]Log out when trading[PI]
    By -Oscar in forum Help
    Replies: 6
    Last Post: 10-17-2010, 06:44 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
  •