Raised This Month: $51 Target: $400
 12% 

[L4D & L4D2] Simple AFK Manager Versus [27-February-2014]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
disawar1
AlliedModders Donor
Join Date: Aug 2011
Location: Russian
Plugin ID:
3841
Plugin Version:
1.2
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    48 
    Plugin Description:
    AFK manager for versus gamemode
    Old 08-19-2013 , 18:28   [L4D & L4D2] Simple AFK Manager Versus [27-February-2014]
    Reply With Quote #1

    Description:

    Simple AFK Manager (SAM) aimed to versus gamemode. See also Co-Op version.


    Features:
    • Supports both left 4 dead games.
    • Supports game PAUSE.
    • Supports READY UP (competitive) plugin.

    Сonsole variables:

    "sam_vs_version", "Simple AFK Manager Versus plugin version"
    "sam_vs_spec_time", "35", "Time before idle player will be moved to spectator in seconds"
    "sam_vs_kick_time", "120", "Time before idle spectator player will be kicked in seconds. 0 = never kick"
    "sam_vs_respect_spec", "1", "Don't kick spectators players if they is no longer AFK"
    "sam_vs_respect_tank", "1", "Don't move AFK players to spectator if they playing as Tank"
    "sam_vs_respect_admins", "k", "Admins have immunity againts AFK manager. Flag value or empty "" to don't protect admins"
    "sam_vs_force_kick", "1", "Kicks all idle spectator players when map changes. (Requires for plugins compatibility that puts spec to spec after map change)


    Plugin forwards:

    PHP Code:
    /**
     * Called whenever plugin moves AFK player to spectator team.
     *
     * @param client        Client index.
     * @return                Plugin_Handled to block, Plugin_Continue otherwise.
     */
    forward Action:SAM_OnClientAFK(client);

    /**
     * Called whenever spectator player is no longer AFK.
     *
     * @param client        Client index.
     * @noreturn
     */
    forward SAM_OnClientAwake(client); 
    How it works:

    AFK DETECTION - If you don't press any game buttons and not chatting you''ll be regarded as AFK player.

    1.) See AFK DETECTED this "sam_vs_spec_time" time period you'll be moved to spectators.
    2.) When you become spectator:
    a) "sam_vs_kick_time" enabled. See AFK DETECTED this "sam_vs_kick_time" time period you'll be kicked.
    b) "sam_vs_respect_spec" enabled. If you no longer AFK or "sam_vs_kick_time" disabled nothing will happend.
    c) If you have immunity againts AFK manager nothing will happend. See "sam_vs_respect_admins" convar.

    Source code GitHub


    Changelog:

    v 1.2 (27 February 2014)
    - Fixed a bug when some players that was moved to spec never be kicked if there admin on server.
    - Makes plugin compatible with some other plugins (see "sam_vs_force_kick" convar).
    - Added forwards that may be useful: SAM_OnClientAwake, SAM_OnClientAFK

    v 1.1 (23 August 2013) 284 views
    - Added 'sam_vs_respect_tanks' convar.
    - Plugin no longer check Dead and 'Bussy' (incapacitated, pounced.. etc) players.

    v 1.0 (20 August 2013) ~22 views
    - Release.
    Attached Files
    File Type: smx sam_vs.smx (8.2 KB, 1161 views)
    __________________

    Last edited by disawar1; 08-30-2018 at 11:33. Reason: update source code link
    disawar1 is offline
    Timocop
    AlliedModders Donor
    Join Date: Mar 2013
    Location: Germany
    Old 08-21-2013 , 01:51   Re: [L4D & L4D2] Simple Afk Manager [Versus]
    Reply With Quote #2

    Nice Plugin!
    BUT:
    PHP Code:
    g_hTimer[i] = CreateTimer(g_fCvarKickTSAM_t_ActionKickiTIMER_FLAG_NO_MAPCHANGE); 
    You should NEVER use TIMER_FLAG_NO_MAPCHANGE when you save a Handle into a Variable and working with it (KillTimer, CloseHandle etc.).
    Because, when the Timer is running, and the Map Changes, the Timer will stop without setting
    PHP Code:
     (Inside the Timer...)
    g_hTimer[i] = INVALID_HANDLE
    and when you run
    PHP Code:
    SAM_TimeToKill(client)
    {
        if (
    g_hTimer[client] != INVALID_HANDLE){

            
    #if debug
                
    PrintToChatAll("[IDLE debug] SAM_TimeToKill(%N)-> Kill %x timer hndl"clientg_hTimer[client]);
            
    #endif

            
    KillTimer(g_hTimer[client]);
            
    g_hTimer[client] = INVALID_HANDLE;
        }

    it throws loooooots of errors because, you know, the timer is already closed. (Or possible Infinite-Error-Loop, because it breaks on 'KillTimer' and never goes to the next step)

    Create a "round_start" or "round_end" Hook to Kill Timers manualy.

    (Sry for my bad english)
    __________________
    Timocop is offline
    disawar1
    AlliedModders Donor
    Join Date: Aug 2011
    Location: Russian
    Old 08-21-2013 , 05:39   Re: [L4D & L4D2] Simple Afk Manager [Versus]
    Reply With Quote #3

    Everything is fine look at line 147. All handles will be equal INVALID_HANDLE, since all clients are disconnected before map change.
    __________________

    Last edited by disawar1; 08-21-2013 at 14:11.
    disawar1 is offline
    Simca
    Senior Member
    Join Date: Feb 2012
    Old 08-21-2013 , 08:08   Re: [L4D & L4D2] Simple Afk Manager [Versus]
    Reply With Quote #4

    Isn't detecting ready state. Using edited 0.17.15

    Last edited by Simca; 08-21-2013 at 08:18.
    Simca is offline
    disawar1
    AlliedModders Donor
    Join Date: Aug 2011
    Location: Russian
    Old 08-21-2013 , 13:56   Re: [L4D & L4D2] Simple Afk Manager [Versus]
    Reply With Quote #5

    Seems like 0.17.15 is outdated and doesn't have the required natives.
    __________________

    Last edited by disawar1; 08-21-2013 at 14:23.
    disawar1 is offline
    winged_box
    Senior Member
    Join Date: Aug 2013
    Location: Singapore
    Old 11-20-2013 , 06:35   Re: [L4D & L4D2] Simple AFK Manager [Versus]
    Reply With Quote #6

    I have players who afk in spectator mode for more than 30 mins and never get kicked.

    This plugin is not working anymore.

    Last edited by winged_box; 11-20-2013 at 06:35.
    winged_box is offline
    disawar1
    AlliedModders Donor
    Join Date: Aug 2011
    Location: Russian
    Old 12-02-2013 , 17:55   Re: [L4D & L4D2] Simple AFK Manager [Versus]
    Reply With Quote #7

    Quote:
    Originally Posted by winged_box View Post
    I have players who afk in spectator mode for more than 30 mins and never get kicked.

    This plugin is not working anymore.
    Uhm? it never happened with me. Can you give me more information? e.g. game, convar settings.
    __________________

    Last edited by disawar1; 12-02-2013 at 17:56.
    disawar1 is offline
    winged_box
    Senior Member
    Join Date: Aug 2013
    Location: Singapore
    Old 12-14-2013 , 19:17   Re: [L4D & L4D2] Simple AFK Manager [Versus]
    Reply With Quote #8

    L4D2 with default cvar setting of this plugin.

    I'm thinking how they can stay as spec for so long without getting kick.
    winged_box is offline
    disawar1
    AlliedModders Donor
    Join Date: Aug 2011
    Location: Russian
    Old 02-26-2014 , 05:19   Re: [L4D & L4D2] Simple AFK Manager [Versus]
    Reply With Quote #9

    Quote:
    Originally Posted by winged_box View Post
    L4D2 with default cvar setting of this plugin.

    I'm thinking how they can stay as spec for so long without getting kick.
    Ahh... I see... I mixed up the operators (break, continue). One more reason why is because some plugins with "unscramble" function causes this issue (spec stays spec, bwa panel etc...). I'll release new version soon.
    __________________
    disawar1 is offline
    disawar1
    AlliedModders Donor
    Join Date: Aug 2011
    Location: Russian
    Old 02-27-2014 , 04:37   Re: [L4D & L4D2] Simple AFK Manager [Versus]
    Reply With Quote #10

    Plugin updated v1.2
    __________________
    disawar1 is offline
    Reply



    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 12:33.


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