AlliedModders
XFactor Servers

AFK Manager (Any Mod) (Version 3.2.3 / Updated October 31 2009)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Rothgar
Senior Member
Join Date: Nov 2007
Plugin ID:
624
Plugin Version:
3.2.3
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Approver:
    Plugin Description:
    AFK Manager/Kicker
    Servers with this Plugin:
    579 
    Old 11-01-2008 , 03:59   AFK Manager (Any Mod) (Version 3.2.3 / Updated October 31 2009)
    Reply With Quote #1

    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.
    Attached Files
    File Type: sp Get Plugin or Get Source (afk_manager-compat.sp - 1859 views - 23.5 KB)
    File Type: smx afk_manager-compat.smx (10.4 KB, 459 views)
    File Type: txt afk_manager.changelog.txt (7.4 KB, 386 views)
    File Type: txt afk_manager.phrases.txt (5.3 KB, 957 views)
    File Type: sp Get Plugin or Get Source (afk_manager.sp - 1099 views - 35.0 KB)
    File Type: smx afk_manager.smx (15.2 KB, 272 views)

    Last edited by Rothgar; 01-17-2010 at 02:29.. Reason: Updated to version 3.2.3
    Rothgar is offline
    Send a message via ICQ to Rothgar Send a message via AIM to Rothgar Send a message via MSN to Rothgar
    crazydog
    SourceMod Donor
    Join Date: Jan 2006
    Old 11-01-2008 , 07:31   Re: AFK Manager
    Reply With Quote #2

    Quote:
    Originally Posted by web compiler
    /home/groups/sourcemod/compiler/include/sdktools_stocks.inc(57) : error 001: expected token: ";", but found "for"
    /home/groups/sourcemod/upload_tmp/textRyuSvp.sp(77) : error 017: undefined symbol "MaxClients"
    /home/groups/sourcemod/upload_tmp/textRyuSvp.sp(89) : error 017: undefined symbol "MaxClients"
    Adding the ; in sdktools_stocks.inc fixes that error, but the other two still show up.

    Now, I'm no sourcemod developer, but adding
    new MaxClients = GetMaxClients();
    after the lines
    // Late Load?
    and
    public OnMapStart()
    {
    caused it to compile correctly....I'll test it...

    (note: Web Compile will not work because of the missing semicolon)

    Also, it's not working in synergy. My config is this:
    Code:
    // This file was auto-generated by SourceMod (v1.0.4)
    // ConVars for plugin "afkmgr.smx"
    
    
    // Admins immune to being kicked? [0 = FALSE, 1 = TRUE]
    // -
    // Default: "1"
    sm_adminsimmune "0"
    
    // Is the AFK manager enabled or disabled? [0 = FALSE, 1 = TRUE]
    // -
    // Default: "1"
    sm_afkenable "1"
    
    // Minimum amount of connected clients needed to kick AFK clients.
    // -
    // Default: "6"
    sm_minplayerskick "0"
    
    // Minimum amount of connected clients needed to move AFK clients to spec.
    // -
    // Default: "4"
    sm_minplayersmove "0"
    
    // Move AFK clients to spec before kicking them? [0 = FALSE, 1 = TRUE]
    // -
    // Default: "1"
    sm_movespec "0"
    
    // Time in seconds before kicking an AFK player.
    // -
    // Default: "120.0"
    sm_timetokick "5.0"
    
    // Time in seconds before moving an AFK player.
    // -
    // Default: "60.0"
    sm_timetomove "5.0"
    and it's not kicking me.
    Attached Files
    File Type: sp Get Plugin or Get Source (afk_manager_fixed.sp - 310 views - 9.7 KB)

    Last edited by crazydog; 11-01-2008 at 07:51..
    crazydog is offline
    Lebson506th
    Veteran Member
    Join Date: Jul 2008
    Old 11-01-2008 , 09:28   Re: AFK Manager
    Reply With Quote #3

    He compiled it vs. 1.1.0 which contains the variable MaxClients and the ; in sdk_tools.
    __________________
    My Plugins
    Spray Tracer by Nican, maintained by me
    Simple TK Manager
    DoD:S Admin Weapons

    Links
    Resistance and Liberation (A HL2 Multiplayer Modification)
    Lebson506th is offline
    Rothgar
    Senior Member
    Join Date: Nov 2007
    Old 11-01-2008 , 12:32   Re: AFK Manager
    Reply With Quote #4

    Quote:
    Originally Posted by crazydog View Post
    Adding the ; in sdktools_stocks.inc fixes that error, but the other two still show up.

    Now, I'm no sourcemod developer, but adding
    new MaxClients = GetMaxClients();
    after the lines
    // Late Load?
    and
    public OnMapStart()
    {
    caused it to compile correctly....I'll test it...

    (note: Web Compile will not work because of the missing semicolon)

    Also, it's not working in synergy. My config is this:
    Code:
    // This file was auto-generated by SourceMod (v1.0.4)
    // ConVars for plugin "afkmgr.smx"
    
    
    // Admins immune to being kicked? [0 = FALSE, 1 = TRUE]
    // -
    // Default: "1"
    sm_adminsimmune "0"
    
    // Is the AFK manager enabled or disabled? [0 = FALSE, 1 = TRUE]
    // -
    // Default: "1"
    sm_afkenable "1"
    
    // Minimum amount of connected clients needed to kick AFK clients.
    // -
    // Default: "6"
    sm_minplayerskick "0"
    
    // Minimum amount of connected clients needed to move AFK clients to spec.
    // -
    // Default: "4"
    sm_minplayersmove "0"
    
    // Move AFK clients to spec before kicking them? [0 = FALSE, 1 = TRUE]
    // -
    // Default: "1"
    sm_movespec "0"
    
    // Time in seconds before kicking an AFK player.
    // -
    // Default: "120.0"
    sm_timetokick "5.0"
    
    // Time in seconds before moving an AFK player.
    // -
    // Default: "60.0"
    sm_timetomove "5.0"
    and it's not kicking me.
    Yes the ; was not in there which was an error, I logged a bug report and this should be fixed in the latest trunk? So you can either add the ; manually or yeah download the latest SourceMod trunk build.

    I believe MaxPlayers has been modified by pred to make it work, I remember seeing a commit saying the rtv plugin etc have been changed to use this new variable, not sure if it's only in the 1.1 trunk or not.

    As for your problem with it not working change sm_minplayersmove to be at least 1, I believe 0 would be disabled.

    Ok was just told that the MaxClients variable might be 1.1 only, if there is a need to use with 1.0 SourceMod versions let me know and I'll make some changes.

    Last edited by Rothgar; 11-01-2008 at 12:46.. Reason: New Information about MaxClients
    Rothgar is offline
    Send a message via ICQ to Rothgar Send a message via AIM to Rothgar Send a message via MSN to Rothgar
    DontWannaName
    Veteran Member
    Join Date: Jun 2007
    Location: VALVe Land, WA
    Old 11-01-2008 , 17:01   Re: AFK Manager
    Reply With Quote #5

    Dont forget to post the compiled plugin as an smx so everyone doesnt have to compile. Are a flagged clients immune too?
    __________________


    Last edited by DontWannaName; 11-01-2008 at 17:07..
    DontWannaName is offline
    Send a message via Yahoo to DontWannaName
    Rothgar
    Senior Member
    Join Date: Nov 2007
    Old 11-01-2008 , 21:22   Re: AFK Manager
    Reply With Quote #6

    Ok changed the MaxClients variable to try and use the older method supported by 1.0x branch of SourceMod.

    Uploaded a compiled version of the plugin as well.

    Quote:
    Originally Posted by DontWannaName View Post
    Are a flagged clients immune too?
    They should be it checks if the client is an admin which I believe returns for any flag.
    Rothgar is offline
    Send a message via ICQ to Rothgar Send a message via AIM to Rothgar Send a message via MSN to Rothgar
    crazydog115
    Junior Member
    Join Date: Jan 2006
    Old 11-01-2008 , 23:23   Re: AFK Manager
    Reply With Quote #7

    Now I'm getting this error:

    Quote:
    L 11/01/2008 - 19:16:51: [SM] Native "IsClientConnected" reported: Client index 11 is invalid
    L 11/01/2008 - 19:16:51: [SM] Debug mode is not enabled for "afk_manager.smx"
    L 11/01/2008 - 19:16:51: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 24 on
    Trying to turn debug on gives me this:
    Quote:
    [SM] Could not toggle debug mode on plugin afk_manager.smx.
    [SM] Plugin returned error: Plugin is not runnable.
    Sourcemod 1.0.4 , build 2537 running on Synergy.
    crazydog115 is offline
    Rothgar
    Senior Member
    Join Date: Nov 2007
    Old 11-02-2008 , 06:05   Re: AFK Manager
    Reply With Quote #8

    Er,

    Can you type sm plugins list

    Tell me if the plugin is loaded?

    Then check the plugin number and type sm plugins debug # on

    Where # is replaced with the plugin number and tell me if it still says the plugin is not runnable??? it it was not runnable then how did it even get to the error message.

    Once I know where it's complaining about checking the IsClientConnected I can look at fixing it but I don't think that error should be causing any problems, sounds like maybe it was doing a check but the client was disconnected or disconnecting or something.

    Also upon some checking, I think the attached compiled smx file was wrong, I have uploaded a new version.

    Last edited by Rothgar; 11-02-2008 at 06:11.. Reason: Additional Information
    Rothgar is offline
    Send a message via ICQ to Rothgar Send a message via AIM to Rothgar Send a message via MSN to Rothgar
    Rothgar
    Senior Member
    Join Date: Nov 2007
    Old 11-02-2008 , 07:49   Re: AFK Manager
    Reply With Quote #9

    Ok after consideration I have now changed this plugin and made it require 1.1 trunk version of SourceMod, you can read the original post for more details.
    Rothgar is offline
    Send a message via ICQ to Rothgar Send a message via AIM to Rothgar Send a message via MSN to Rothgar
    crazydog
    SourceMod Donor
    Join Date: Jan 2006
    Old 11-02-2008 , 16:52   Re: AFK Manager
    Reply With Quote #10

    First of all, Synergy doesn't like SM 1.1

    Second, I'll answer your questions anyway:

    The plugin IS loaded with errors
    I told you what happens when I try to turn on debug
    crazydog is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 10:17.


    Powered by vBulletin® Version 3.8.1
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
    Theme made by Freecode Sponsored by Layered Technologies