View Full Version : DoD AFK Manager (v1.0)
Firestorm
07-08-2006, 11:38 AM
// DESCRIPTION:
// ============
//
// This is a real simple, but powerful AFK/Spectator Kicker!
// It's absolutely independent from the players position on
// the map as the counter until he's kicked starts to run down
// as soon as he joins the server and is only reset and starts
// from the beginning in the following cases:
// - player damages/kills another player
// - player gets score for taking a flag
// - player types in global-/teamchat
// - player throws a grenade
// - player changes team / switches class
// The SpectatorKicker is completely independent from the AFKKicker,
// as the action of the AFKKicker stops as soon as a player joins
// Spectators and the SpecktatorKicker takes over. Same applies
// vice versa, so you can safely only use one (or both for sure) parts
// of the plugin.
//
// * admins with a reserved slot who are afk aren't kicked
// * spectating admins aren't kicked
// * fakeclients, bots, hltvs aren't kicked either
// USAGE:
// =====
//
// cvars:
// ------
//
// dod_afkmanager_afkkick <1/0> = enable/disable AFK Manager (kicker)
//
// dod_afkmanager_afkkicktime <time> = sets time in seconds a player can be AFK
// before he's kicked off the server.
//
// dod_afkmanager_speckick <1/0> = enable/disable SpectatorKicker
//
// dod_afkmanager_speckicktime <time> = sets time in seconds a player can be a
// spectator before he's kicked off the server
//
// dod_afkmanager_minplayers <amount> = minimum number of players that have to be on the
// server to get rid of afks and spectators
// CHANGELOG:
// ==========
//
// - 13.07.2005 Version 0.5beta
// Initial Release
//
// - 17.07.2005 Version 0.6beta
// bugfixes:
// - fixed errors that resulted from missing
// checks whether the player was already connected
// or still connecting.
//
// - 12.08.2005 Version 0.7beta
// tweaks:
// - added afktimer reset for shooting, switching weapons
// and bringing up the scope (snipers)
// bugfix:
// - resetting afktimer for capping flags is working now
//
// - 26.06.2007 Version 0.8
// - removed unneeded code
// - removed unreliable afk-timer reset-functions
// - added reset for throwing grenades
// - added reset for changing class
// - updated "team change function" to use dod_client_changeteam
// forward
// - changed to pcvar system
// - optimized the code
//
// - 27.06.2007 Version 0.85
// - replaced only catching Global-/TeamChat of a player
// with catching all of his commands.
// - commands like "sprone, weapon_* , say, say_team" are cought
// now
//
// - 02.07.2007 Version 0.9
// - added global tracking cvar
//
// - 20.07.2007 Version 1.0
// - replaced "client_death" with hooking the
// "DeathMsg"-Event for better reliability
// - added "German" language definitions to the
// language file
//
snowyfriend
10-24-2006, 01:15 AM
Any change the amxx mode can be created ???
diamond-optic
10-24-2006, 12:07 PM
Any change the amxx mode can be created ???
what? that doesnt make any sense....
snowyfriend
10-25-2006, 12:21 AM
Never mind - i'm new at all this codeing but i've worked it out :p Thanks for the reply anywho
Church
10-25-2006, 03:54 AM
Does this plugin even work for anyone. I have it kicking people not even afk and leaving afk's in. I will post my server stats if it really is needed but I think this isnt working for alot of peolpe.
Scrappy
05-29-2007, 05:25 PM
any update on this pluggin please, it's not working on my server, Thanks
FeuerSturm
06-26-2007, 03:32 PM
Hey guys!
i just updated the AFK Manager to Version 0.8!
Please give it a chance again as i removed all unreliable
"detections" and updated the 100%ly reliable detections.
here's the change log, please let me know about problems
and bugs!
//
// - 26.06.2007 Version 0.8
// - removed unneeded code
// - removed unreliable afk-timer reset-functions
// - added reset for throwing grenades
// - added reset for changing class
// - updated "team change function" to use dod_client_changeteam
// forward
// - changed to pcvar system
// - optimized the code
//
Grottenolm
06-26-2007, 04:05 PM
Hey guys!
i just updated the AFK Manager to Version 0.8!
Wow, you are churning out new versions of your Plugins at a really astonishing rate! I hope your new Girlfriend get's enough attention, still ;)
Anyway, as soon as I verified the new Team Manager and TK Management, I'll definitely give this one a try.
Grottenolm
06-26-2007, 08:16 PM
Well, at least with AMXX 1.76a (didn't update to "d" yet) I definitely have wrong kicks, still. A sniper got kicked in the middle of sniping... but he moved, not standing 100% still...
But then, in the code I can't see anything that rects to simply moving. So if you don't chat, kill, get killed, score flags - you just walk around, then you are counted as AFK... right?
Anything I can do to help debug? Maybe provide the 10 Minute HLTV Demo I took and some logfile entries, as well as the config?
FeuerSturm
06-27-2007, 02:57 AM
there are actually 2 problems:
1st problem:
a position check is unreliable, means if a player is really afk and standing
in his spawn and he gets TKed or blown up with an enemy grenade
his position on the map changes as well as it changes when the round
is won/lost and he respawns.
so i can neither check his position nor if he got wounded or killed as that can
happen without any interaction of the "afk" player.
2nd problem:
looking for a user moving is possible and reliable BUT will use a lot of
resources as the timer is reset everytime he presses a movement key,
so it would be like that for 5 seconds of walking around:
reset, reset, reset, reset, reset, reset, reset, reset, reset, reset, reset,
reset, reset, reset, reset, reset, reset, reset, reset, reset, reset, reset
and so on......
what i can add though is a check if he's having anything in his hands
that's not his primary gun. so if he changes his weapon to grenade or
spade/knife the time will be reset.
a check if he switches to his primary gun would be useless as that's called
when a player spawns as well.
but i still have two questions:
- what time are you using to kick afks?
- is a player really contributing to the game that doesn't really interact
and just moves around?
Grottenolm
06-27-2007, 04:53 AM
there are actually 2 problems:
but i still have two questions:
- what time are you using to kick afks?
- is a player really contributing to the game that doesn't really interact
and just moves around?
Currently I have 120 Seconds for Players, 320 Seconds for Spectators.
But actually I selected these values not knowing exactly how this plugin works. I know, RTFM ;) You are absolutely right about the "contributing to gameplay", though, so I guess I will simply increase the time to kick a bit.
On the other hand, one less resource hungry (at least I would beleive so) way to check for movement could be by setting up a task that is run, say, every minute or so. It saves the position (or better, yet, also the view vector) of each player. The next time it is run, it compares the new position to the old one. If it is different, it saves the new values and resets the FAK counter. If it is the same as before, it does nothing.
Other detections that I could imagine to be save would be reloading, shooting, ducking, going prone etc. - but since I have no idea how resource intensive stuff like that is, I cannot really see if it is possible to use such stuff.
My problem was/is, that in case I am on some server, I would expect that "moving" shows I am not AFK - so when being on the phone I would move around a bit, expecting not to be kicked. Seemingly other players have the same perception, not knowing what is involved programming-wise.
FeuerSturm
06-27-2007, 02:37 PM
ok, here's the new version, please see changelog:
//
// - 27.06.2007 Version 0.85
// - replaced only catching Global-/TeamChat of a player
// with catching all of his commands.
// - commands like "sprone, weapon_* , say, say_team" are cought
// now
//
now only players that really don't do anything (besides running around)
will be kicked.
Please be sure to use a kicktime between 3 and 10 minutes for best
results!
@Grottenolm
For your position checking suggestion please check "1st problem" in my
last post! ;)
if you're not really sure why it's unreliable please send me a PM and i'll
explain it in german :D
Grottenolm
06-27-2007, 04:28 PM
now only players that really don't do anything (besides running around)
will be kicked.
Please be sure to use a kicktime between 3 and 10 minutes for best
results!
@Grottenolm
For your position checking suggestion please check "1st problem" in my
last post! ;)
if you're not really sure why it's unreliable please send me a PM and i'll
explain it in german :D
I see, it simply is a different approach actually. So I'll set the kick time higher, to be sure to kick either AFKers or totally unproductive guys :)
I understand the "1st problem"... although I personally didn't weigh it much. This is since I was thinking of fairly low kick times like 2 minutes, where the chance of a round change or map change is fairly low. Also I didn't really have much concern about players' positions changing due to being killed / TKed, since this is quite rare... plus it does not really lead to "false positives" (not AFK players being kicked for AFK), it would "only" lead to cases of AFK players not being kicked after the time set. But as I said, when thinking about low kick times, it doesn't really matter if an AFKer is kicked after 2 or 4 minutes. Even one could take care of this from a coding standpoint... for example with 2 or 3 sets of "last positions". So one could detect if the position has only changed sporadically over the last x minutes...
But anyway for the new version, I think the plugin should work perfectly as soon as I use it as it was designed (longer kick times), so I don't see a real need for any further additions. I'll start the test run tonight...
But one additional question: I didn't find an exhaustive list on the AMXX website telling what kinds of actions are caught by the client_command. Do you have a link to a list or a description?
FeuerSturm
06-27-2007, 04:50 PM
But one additional question: I didn't find an exhaustive list on the AMXX website telling what kinds of actions are caught by the client_command. Do you have a link to a list or a description?
Actually i don't have a description, i created a little testplugin that
displays when and what command has been caught.
Commands caught that i actually remember:
sprone (= user pressed "Prone" key)
say (= user talks in global chat)
say_team (= user talks in team chat)
jointeam (= user selected/changed team)
cls_******* (= user selected class "********")
weapon_****** (= user selected weapon "******")
there are still some other that i'll post if i can remember them! :D
EDIT:
lastinv (= user presses key to switch to last used weapon)
changeclass (= user opens "Change Class" menu)
changeteam (= user opens "team selection" menu)
drop (= user presses "Drop weapon" key)
dropammo (=user presses "Drop MG Ammo" key)
dropobject (= user drops an object (like sattchelcharge etc..))
voice_menu* (= user opens the voice menus)
voice_***** (= player uses voice announcements)
menuselect (= player pressed a key in a menu)
amx_********* (= admin commands will be caught as well)
i think there's still a few more, you can try with a simple function:
public client_command(id)
{
new command[32]
read_argv(0,command,31)
client_print(id, print_chat,"COMMAND: '%s' caught!!!!!", command)
log_amx("Command: '%s' has been caught!",command)
return PLUGIN_CONTINUE
}
then you just have to run through the map and press all kind of keys :D
=|[76AD]|= TatsuSaisei
06-27-2007, 05:24 PM
public client_command(id)
{
new command[32]
read_argv(0,command,31)
client_print(id, print_chat,"COMMAND: '%s' caught!!!!!", command)
log_amx("Command: '%s' has been caught!")
return PLUGIN_CONTINUE
}
then you just have to run through the map and press all kind of keys :D
Thanx !! After reading his post I got curious myself and started searching the amxmodx forum and come up bust.. then decided I was going to make a simple logger, but you did the work for me !!!
Thanx
FeuerSturm
06-27-2007, 05:29 PM
|= TatsuSaisei;6536']Thanx !! After reading his post I got curious myself and started searching the amxmodx forum and come up bust.. then decided I was going to make a simple logger, but you did the work for me !!!
Thanx
You're welcome, but please take into account that it's only logging
the command and not the arguments! (only logs "jointeam" NOT "jointeam 1"
for example).
but you can change the code to log the arguments as well as needed.
just use "read_args ( output[], len )" instead of read_argv and you
ave the full commandline including all arguments.
FeuerSturm
07-02-2007, 06:11 PM
//
// - 02.07.2007 Version 0.9
// - added global tracking cvar
//
As always, please report bugs with the new version immediately!
Enjoy!
diamond-optic
07-02-2007, 06:21 PM
//
// - 02.07.2007 Version 0.9
// - added global tracking cvar
//As always, please report bugs with the new version immediately!
Enjoy!
what bugs could there be from just adding a public cvar :P
FeuerSturm
07-02-2007, 06:23 PM
what bugs could there be from just adding a public cvar :P
actually none, but as i'm updating all plugins and not only adding
the tracking cvar i use that sentence as "standard" ;) :cool:
FeuerSturm
07-20-2007, 02:14 PM
//
// - 20.07.2007 Version 1.0
// - replaced "client_death" with hooking the
// "DeathMsg"-Event for better reliability
// - added "German" language definitions to the
// language file
//
lately i noticed that people that are AFK for longer than i set the timer
still remain on the server and i think i finally found the problem and fixed
it. it's the "client_death" forward that i was using that is buggy
(well know by the devs and hopefully fixed in AMXX 1.80),
so i replaced it with the "old" method of hooking the "DeathMsg" which
is absolutely reliable.
If you still encounter AFKs remaining on your server, please let me know!
P.S.:
German, English, French language is already within the dictionary,
i'd be glad to get some more languages!
Bandit
10-23-2007, 01:32 PM
Why did you use soo long cvars?
Ba5ic
11-26-2007, 05:11 PM
Hello Guys
Any assistance would be greatly appreciated, i've set the afk manager using the following cvars:
// DoD_AFK Manager cvars:
//
dod_afkmanager_afkkick 1 = enable/disable AFK Manager (kicker)
dod_afkmanager_afkkicktime 360 = sets time in seconds a player can be AFK
// before he's kicked off the server.
dod_afkmanager_speckick 1 = enable/disable SpectatorKicker
dod_afkmanager_speckicktime 360 = sets time in seconds a player can be a
// spectator before he's kicked off the server
dod_afkmanager_minplayers 2 = minimum number of players that have to be on the
// server to get rid of afks and spectators
Firstly i removed my admin rites to test it's working. I then tried the spec kick and after 360 seconds it indeed booted me off. Now my problem i joined axis and just waited in spawn without moving and nothing happened, this is set to 360 seconds as well. I also tried it as allies but same problem.
Any idea's please??!!.
Thanks in advance.
Ba5ic
11-30-2007, 04:21 AM
Any idea's guys?
TIA
Ba5ic
01-01-2008, 07:58 AM
Hello Guys
Any assistance would be greatly appreciated, i've set the afk manager using the following cvars:
// DoD_AFK Manager cvars:
//
dod_afkmanager_afkkick 1 = enable/disable AFK Manager (kicker)
dod_afkmanager_afkkicktime 360 = sets time in seconds a player can be AFK
// before he's kicked off the server.
dod_afkmanager_speckick 1 = enable/disable SpectatorKicker
dod_afkmanager_speckicktime 360 = sets time in seconds a player can be a
// spectator before he's kicked off the server
dod_afkmanager_minplayers 2 = minimum number of players that have to be on the
// server to get rid of afks and spectators
Firstly i removed my admin rites to test it's working. I then tried the spec kick and after 360 seconds it indeed booted me off. Now my problem i joined axis and just waited in spawn without moving and nothing happened, this is set to 360 seconds as well. I also tried it as allies but same problem.
Any idea's please??!!.
Thanks in advance.
I guess this plugin is defunk'd now - the spectator kick option is working fine but the AFK kick option does not work. I use the spec option and have had to install a diff afk kicker, annoying but there you go.
I was looking at Brads Play or be kicked Plugin http://forums.alliedmods.net/showthread.php?p=126963
It says it's for CS only but could this be mod'ed to DoD - If it can, i'll make a formal request in the relevant section here.
It's just frustratin, i would like an all in one spec/afk kicker :)
PS. i have PM'ed Brad about its compatibility with DoD.
Ba5ic
02-19-2008, 03:00 PM
Hello Guys
Any assistance would be greatly appreciated, i've set the afk manager using the following cvars:
// DoD_AFK Manager cvars:
//
dod_afkmanager_afkkick 1 = enable/disable AFK Manager (kicker)
dod_afkmanager_afkkicktime 360 = sets time in seconds a player can be AFK
// before he's kicked off the server.
dod_afkmanager_speckick 1 = enable/disable SpectatorKicker
dod_afkmanager_speckicktime 360 = sets time in seconds a player can be a
// spectator before he's kicked off the server
dod_afkmanager_minplayers 2 = minimum number of players that have to be on the
// server to get rid of afks and spectators
Firstly i removed my admin rites to test it's working. I then tried the spec kick and after 360 seconds it indeed booted me off. Now my problem i joined axis and just waited in spawn without moving and nothing happened, this is set to 360 seconds as well. I also tried it as allies but same problem.
Any idea's please??!!.
Thanks in advance.
Can anyone help me out here please, as stated above the spec option works but not the afk kicker, has anyone any idea's as to why it does not kick AFK'ers?.
I really like how the plugin and how it works albeit the spec part.
Failing this, could one of the coder's look kindly on me and possibly write me a new spec/afk management plugin.
Thanks In Advance.
WARDOG
03-10-2008, 02:50 PM
I still use his:
// - 12.08.2005 Version 0.7beta
// tweaks:
// - added afktimer reset for shooting, switching weapons
// and bringing up the scope (snipers)
// bugfix:
// - resetting afktimer for capping flags is working now
//
It still works fine 98% of the time. Rare instance of not kicking, or kicking person moving, but for the most part works fine for us.
dod_afkmanager_afkkick 1
dod_afkmanager_afkkicktime 300
dod_afkmanager_speckick 1
dod_afkmanager_speckicktime 300
dod_afkmanager_minplayers 1
300 = 5 min.
Maybe try setting your spec time equal to the in game time.
Ba5ic
10-26-2008, 10:26 AM
This has suddenly started working for me since i updated to 1.81v !?.
shortround
01-05-2012, 12:20 PM
Can you add ability to allow players who are afk to just be put in spectator ?
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.