### Created by Xpert from Atomix
### irc.ax-games.net
### www.ax-games.net


### CREDITS
Thanks to iRan for the original code and concept for SSGM 2.0.2
Thanks to reborn for the original code of Find_Closest_Building in SSGM 2.0.2


### DESCRIPTION ###
This plugin will detect when players go AFK ingame. It will output through the SSGM
log messages with the prefix _ALERT. The plugin doesn't do anything when there's only
one player in-game. There's an option to disable checking score if Power Plant
and/or Refinery is down, and an option to PM a player if he's marked AFK but it won't do any kicking.

The plugin marks a player AFK during a check when first:

- He hasn't gained points (with the threshold logic taken in account and the option to disable checking points when PP/Ref is destroyed).
- When his position hasn't changed within a small renefeet threshold.
- If his facing hasn't changed.

And if he doesn't do any of the following:
- When he hasn't fired any shots.
- Doesn't speak.
- Doesn't enter or exit a vehicle.
- Doesn't purchase anything.


### CHANGELOG ###

V1 - Release
V2 - Fixed issue with closest building not showing in messages



### Installation ###

Place this in the ssgm.ini plugins list of course. Below is what should be in your
SSGM.ini for the AFK_Detector settings.


[AFK_Detector]

; AFK_Time=
;
;  Time to wait before checking again whether someone is AFK.

AFK_Time=300

; AFK_Score=
;
;  Minimum score needed to not be checked for being AFK.

AFK_Score=100

; AFK_PM=
;
;  Whether or not to page the player for being AFK.

AFK_PM=true

; AFK_DeadPP=
;
;  Check for point changes when the Power Plant is dead.

AFK_DeadPP=true

; AFK_DeadREF=
;
;  Check for point changes when the Tiberium Refinery is dead.

AFK_DeadREF=true

; AFK_Message=
;
;  Message to send the AFK player if AFK_PM is set to true.

AFK_Message=You have been automatically marked as AFK. Please start playing or type something to be unmarked.