Getting the Time a Player is Looking at Another Player

Discussion in 'Plugin Development' started by m1enkrafft_man, Jun 15, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    m1enkrafft_man

    Basically, what I am attempting to do is determine the amount of UNINTERRUPTED time that a person is looking at another player. My guess was that it had something to do with setting a Boolean to true, and while it is true, and every tick add a value of 1 to an int 'till it's false. The only problem I'm having is (well, there's two):
    • determining when a player is looking at a player
    • Getting the amount of ticks (This isn't the priority, I can figure this out with some simple Maths)
    Any help guys?
     
  2. you need to get the line of sight of some epopel for that, and do some math for every block in its like of sides for close entities
     
  3. Offline

    m1enkrafft_man

    I get that... But what I'm asking is which listener(s) would I use? I can figure it out from there.... but the JavaDocs are a pain to sift through, and I'm really quite busy pumping this plugin out.
     
  4. You can use the PlayerMoveEvent for this
     
  5. Offline

    m1enkrafft_man

    Okay. Thanks a lot :D
     
  6. Offline

    dxwarlock

    Wait ferry, not to butt in, but wouldn't 'onmove' not really be reliable in rare cases.
    Like if In standing 2 blocks from someone, I can move my mouse a bit left and right, but still have my crosshairs on them. it would still trigger a move-event. or even if they are running at them, but 'looking' at them
    unless hes meaning uninterrupted as in not moving forward or moving mouse (just staring), then what you suggested would be by far the easiest way :).
     
  7. Offline

    m1enkrafft_man

    I meant how long the person is staring directly at them (crosshairs, not just FoV). What I'm attempting to do is create a notification system to determine if someone might be using aimbot.
     
  8. but actually you should listen for this on that event, because the result, looking or not depends the position of the player, and the looking side, and whit this event, you catch chances of those variables
     
  9. Offline

    dxwarlock

    hmmm i dont THINK there is a player version of 'GetTargetBlock(), not sure what (or if) it returns anything when pointing at a player.

    true didnt think that far ahead, as in until they move, the target wont change.
    well unless the player they are looking at moves, so maybe have to trigger it on anyone moving? because I can stare at you and go AFK, and you wander off, but until I come back and make a move event, it wouldn't be checking if you was still there.

    at least by the logic steps Im thinking.. "check where im pointing, when I move again see if Im still pointing at it. if not give time between when I pointed and when my next move event was when I lost sight of it".

    so it would just go "5 minutes ago hes pointing at you, then on his next moveevent hes not..so 5 minutes of looking at you" even though you left 10 seconds after I stopped moving.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 26, 2016
  10. Player.getLineOfSight(Map,int);
     
Thread Status:
Not open for further replies.

Share This Page