#How do I detect player movement that is only done by the player?
1 messages · Page 1 of 1 (latest)
A good way to combat simple AFK machines is to compare the player's pitch and yaw.
(Basically the things that let you look up, down, left and right.)
Compare their values every so often and if they haven't changed in while, you could mark the player as AFK.
Ah, shouldn't I worry about the player starting to move without moving their head though?
This isn't a perfect method as players could still use hacked clients with mods such as Derp that would randomize where they look.
But, it's a good solution for most players.
Possibly, but it would depend on the situation.
What kind of situations are you thinking of that would need the player to move first?
You mean before they move their head?
Yes
Oh I'm just thinking a player might start moving using the wasd and not the mouse
And it would be weird if they will still count as being afk
I mean, players can run around without moving their mouse, but it limits their movement significantly.
It's pretty common for AFK players to not touch their mouse, but be able to be pushed by other players. That action of moving them triggers most AFK systems to mark them as no longer AFK. If you instead just compare their pitch and yaw values instead of an actual location, you can get a better measurement of whether or not they are AFK.
This also allows you to teleport players to a location and still have them be AFK. (So long as they keep the direction they are looking at.)
Ah I see, then it is possible for them to move without moving their mouse but it's just not that likely
So I better use this method other than just checking their location
Yes. You could try and combine both methods, but this method is one of the simple but effective ones.