AFK Manager
This plugin was developed based off Liam's "Basic AFK Manager" which can be found here http://forums.alliedmods.net/showthread.php?t=74531. Liam's instructed me to create a separate thread for this modified version.
This version has since changed to include what I believe to be bug fixes, modifications to the way the timer checking works (per user instead of a single global timer and lower interval 5 second [by default] checks rather than 10 second), and includes some new features such as player notification before kick. Also removed a second redundant un-necessary timer I believe.
Information
This
plugin has been designed to handle AFK players. It checks each player every 5 seconds (by default) to see if they are still in the same position and also looking at the same place. If they are and are not "typing/chatting" or have not moved they are deemed "AFK" and the
plugin will both move and/or kick them after a specified amount of time. It will also warn players before being moved or kicked based on specific variables. This
plugin also includes translation file for other languages and admin immunity.
Requirements
SourceMod v1.0.4 (Maybe less) (Old COMPAT version only)
SourceMod v1.1.0+ (Latest version)
Installation Details
Download the "afk_manager.phrases.txt" and save to your addons\sourcemod\translations directory.
Download the "afk_manager.sp" and save to your addons\sourcemod\scripting directory.
Compile the
plugin and install as per normal.
Server ConVars
- sm_afkm_version - Version of AFK Manager. (No edit)
- sm_afk_enable - Is the AFK manager enabled or disabled? [0 = FALSE, 1 = TRUE]
- sm_afk_move_min_players - Minimum amount of connected clients needed to move clients to spectator. (0 should be disabled)
- sm_afk_kick_min_players - Minimum amount of connected clients needed to kick AFK clients. (0 should be disabled)
- sm_afk_kick_players - Should the AFK manager kick clients? [0 = DISABLED, 1 = KICK ALL, 2 = ALL EXCEPT SPECTATORS, 3 = SPECTATORS ONLY]
- sm_afk_admins_immune - Are Admins immune to to the AFK Manager? [0 = DISABLED, 1 = COMPLETE IMMUNITY, 2 = KICK IMMUNITY, 3 = MOVE IMMUNITY]
- sm_afk_admins_flag - Admin Flag for immunity? Leave Blank for any flag.
- sm_afk_move_spec - Move AFK clients to spec before kicking them? [0 = FALSE, 1 = TRUE]
- sm_afk_move_warn_time - Time in seconds remaining, player should be warned before being moved for AFK. [DEFAULT: 30.0 seconds]
- sm_afk_move_time - Time in seconds (total) client must be AFK before being moved to spectator.
- sm_afk_kick_warn_time - Time in seconds remaining, player should be warned before being kicked for AFK. [DEFAULT: 30.0 seconds]
- sm_afk_kick_time - Time in seconds (total) client must be AFK before being kicked.
- sm_afk_exclude_dead - Should the AFK manager exclude checking dead players? [0 = FALSE, 1 = TRUE]
* Note: The cfg file should be automatically created when the plugin is first loaded in cfg\sourcemod\afk_manager.cfg. If you delete this file it will re-create with the correct (default) cvars on plugin start/map change.
Server Commands
- sm_afk_spec - Usage: sm_afk_spec <#userid|name>
Change Log
* See the afk_manager.changelog.txt for old version information.
- 3.2.0 - This version is no longer a "compat" build, meaning it will not compile on SourceMod 1.0.x anymore, you will need the latest Stable SourceMod version or higher (Should compile on anything higher than 1.1.x).
New features/fixes in this release:
- Disable the AFK Manager on OnMapEnd() and Re-enable on OnMapStart()
- Now hooking TF2 WaitingForPlayers at start of map and disables the AFK Manager during this time.
- Now hooking TF2 Arena mode properly (Hopefully) to implement certain Hooks/Fixes due to valve majorly fucking this up.
- After a LONG time of testing and checking just what the hell Valve broke when implementing a very stupidly designed "Arena
Spectator" mode which uses weird player properties to deem whether a player is an actual
spectator or a "Waiting to play" person, which I think is very stupid, they should have made it the other way around imo so that
spectator is normal and "waiting to play" required changes. However after extensive testing I think I have finally found a work-around to fix this.
I would like to thank Atreus and his players for helping test numerous versions of the AFK Manager to try and fix the Arena issues. Made some good progress with this. I would also like to thank predcrab for in the end showing me how I could look at all entity changes for a given entity. With this I was able to compare my move function against the proper one to see differences of a few core entities.
- 3.2.1 - Added new command by request sm_afk_spec which will force a player to the spectator team. Requires new translation file and if possible updates to other languages.
- 3.2.2 - Fixed a small problem with the sm_afk_spec command possibly not killing timers properly if Spectator kick was disabled?
- 3.2.3 - Change Admin flag required for sm_afk_spec command from ADMFLAG_SLAY to ADMFLAG_KICK.
Please let me know if you experience any issues or problems.
Credits
- Liam - For creating the original AFK Manager.
- Tsunami and FlyingMongoose - Recommending change of OnClientPutInServer to OnClientPostAdminCheck.
- predcrab - For suggesting IsClientObserver() checks over static team checking.
- Brizad - Suggesting a TF2 Stalemate check.
- Tsunami - Picking up Convar flags being wrong.
- Antithasys - Helping fix general timer close issues.
- retsam - Helping fix additional timer issues.
- OziOn - Submitting the Danish translations.
- Cadav0r - Submitting the French translations.
- Snake60 - Submitting the Russian translations. Updated by SelaX.
- niask - For pointing out the translation file needed to be UTF-8 without BOM.
- Atreus - Finding some spectator check issues with MOTD etc.
- dann - Picking up that timers were getting created twice per user in some situations.
- Zuko - Submitting the Polish translations.
- Guggie - Submitting updated German translations.
- KhyrOO - Submitting the Hungarian translations.
Other plugins made by me:
Anti-TK Manager: http://forums.alliedmods.net/showthread.php?t=80554
File Information
afk_manager-compat - This is an old release which is no longer kept up-to-date and only available for older SourceMod releases.
afk_manager - This is the current version.
You only need one of the above files most likely the NON compat version NOT both.