[FilterScript] AutoAFK System
#1

AutoAFK
(written by Manyula)
Hello folks,

Here goes my very first release. It's nothing too special but yet, it cost me some time to figure out the logics behind it. From this point of view, it is kind of my personal result of "learning by doing".

How does it work?
It's pretty simple. A global timer checks every 5 seconds (change AUTO_AFK_CHECK_INTERVAL to in- or decrease the interval) whether a player has moved with a simple position and typing check. If the player hasn't moved, a non-repeating timer of 5 minutes (change AUTO_AFK_TOLERANCE to determine when a player goes AFK after not having moved) is initiated. In case the player moves or types something in the chat during the timer is active, the AFK detection variable will be resetted, ultimately killing the timer.

While AFK, the player will be frozen and set to godmode, protecting him from any damage. As soon, as he returns to the game, he will be given the amount of HP and AP he had when he went AFK. This prevents players from abusing it for health refill.

How do I use it?
For those of you who are not familiar with the procedure: add "AutoAFK" to your filterscripts folder and the filterscripts line in your server.cfg and you're ready to go.

NOTE:
You might want to add a check, whether the player has taken any damage when trying to go AFK, to prevent people from evading death. But that's up to you, so I intentionally left it out.

Pastebin: http://pastebin.com/b0aKCgcG

Thank you for taking a look at this, I appreciate it!

Regards, Manyula
Reply


Messages In This Thread
AutoAFK System - by Manyula - 10.07.2014, 20:51

Forum Jump:


Users browsing this thread: 2 Guest(s)