AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sort of afk manager (https://forums.alliedmods.net/showthread.php?t=193857)

Misery 08-23-2012 10:54

Sort of afk manager
 
Hi,

I'm trying to achieve an AFK manager which will be different than others...
Basically afk managers check if a player has moved (origin changes) in an infinite task flagged "b".
However, I find this method not the best to check for afks... indeed if someone moves his mouse for example without changing position, he would still be considered afk.

I was wondering...

1- Is there a hook we could set which would fire on every player move (including moving mouse and such?)
2- In the case that hypothetic hook is not possible in question #1, instead of having a task which loops say at each 5 seconds, is there a hook we could have which would fire on each time the position of a player changes?
3- Any other ideas?

Thanks!

Misery

Exolent[jNr] 08-23-2012 11:21

Re: Sort of afk manager
 
We can use a forward like FM_CmdStart to know when the last time the player pressed a button.
Then we can use PreThink to know if a player's angles changed, since there is no hook for mouse movement.
Finally, your overall check for buttons/angles could be in a task for all players, or just check in PreThink.

I can write a quick example if needed.


All times are GMT -4. The time now is 05:45.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.