AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Simple AFK Manager Versus [27-February-2014] (https://forums.alliedmods.net/showthread.php?t=224065)

disawar1 08-19-2013 18:28

[L4D & L4D2] Simple AFK Manager Versus [27-February-2014]
 
1 Attachment(s)
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.

Timocop 08-21-2013 01:51

Re: [L4D & L4D2] Simple Afk Manager [Versus]
 
Nice Plugin! :)
BUT: :grrr:
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)

disawar1 08-21-2013 05:39

Re: [L4D & L4D2] Simple Afk Manager [Versus]
 
Everything is fine look at line 147. All handles will be equal INVALID_HANDLE, since all clients are disconnected before map change.

Simca 08-21-2013 08:08

Re: [L4D & L4D2] Simple Afk Manager [Versus]
 
Isn't detecting ready state. Using edited 0.17.15

disawar1 08-21-2013 13:56

Re: [L4D & L4D2] Simple Afk Manager [Versus]
 
Seems like 0.17.15 is outdated and doesn't have the required natives.

winged_box 11-20-2013 06:35

Re: [L4D & L4D2] Simple AFK Manager [Versus]
 
I have players who afk in spectator mode for more than 30 mins and never get kicked.

This plugin is not working anymore.

disawar1 12-02-2013 17:55

Re: [L4D & L4D2] Simple AFK Manager [Versus]
 
Quote:

Originally Posted by winged_box (Post 2063152)
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.

winged_box 12-14-2013 19:17

Re: [L4D & L4D2] Simple AFK Manager [Versus]
 
L4D2 with default cvar setting of this plugin.

I'm thinking how they can stay as spec for so long without getting kick.

disawar1 02-26-2014 05:19

Re: [L4D & L4D2] Simple AFK Manager [Versus]
 
Quote:

Originally Posted by winged_box (Post 2072099)
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 02-27-2014 04:37

Re: [L4D & L4D2] Simple AFK Manager [Versus]
 
Plugin updated v1.2


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

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