Raised This Month: $66 Target: $400
 16% 

Hobo AFK Management ( FINAL )


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   BAILOPAN (72)
hoboman
Senior Member
Join Date: Jul 2007
Old 04-07-2008 , 19:50   Hobo AFK Management ( FINAL )
Reply With Quote #1

Hobo AFK Management

Description:
This started out as a modification of Cheesy's "Generic AFK Kicker", but I ended up completely rewriting it. In a nutshell the purpose of this plugin is to manage the AFKs on a server according to cvars.
Requirements:Cvars:
hobo_afk_frequency ( default 1 ) - the frequency with which this plugin will check each player's AFK status
hobo_afk_time x ( default 60 ) - the maximum allowed AFK time for an alive player
hobo_afk_immunity x ( 0/1 - default is 1 ) - if set to 1 then the admins with the immunity flag ( admin immunity, flag "a" is the default ) cannot be kicked by this plugin
hobo_afk_kick x ( 0/1 - default is 0 ) - if set to 0 then after a player is AFK for more than "hobo_afk_time"he will be put to spectator, otherwise he will be kicked
hobo_afk_spectator_kick x ( 1-32 - default is 16 ) - after this many players have joined the server, when a new player connects a spectator will be kicked. Also if there are more than this many players, an AFKer will get kicked regardless of what "hobo_afk_kick" is set to.
hobo_afk_unassigned_time x ( default is 60 ) - after this many seconds have passed if the newly connected player is still unassigned he will be kicked
hobo_afk_warning_time x ( default is 10 ) - start warning a player this many seconds before he is kicked or put to spectator about his AFK status
Plugin Notes:
- the admin AFK immunity by default is set to flag "a", but can be changed in the .sma by the AFK_IMMUNITY define
- by default all the players are checked for AFK every 1 second, this can be modified in the .sma by the CHECK_FREQUENCY define ( if this is set bellow 1, the player may be counted as not AFK on player spawn )

Changelog:
  • 1.1
    • rewritten the spawn method using the hamsandwich spawn method, which is the best and most efficient method according to VEN
    • made a lot of minor modifications
    • removed the cstrike module from the plugin, big thanks to x-olent
    • fixed the bug where the unassigned players would not get kicked when connected to a server
  • 1.2
    • added hobo_afk_frequency cvarand renamedthe hobo_max_afk_unassigned_time cvar to hobo_afk_unassigned_time
    • add support for servers with freeze time, so the player's AFK time will not be counted during freeze time
    • made it so the player has to move over 15 units ( can be changed by the AFK_MOVE_DIST define in the .sma ) to be viewed by the plugin as not AFK
    • added a check for when a player joins a team and then idles without choosing a model. By default all players that do this will be kicked after one round
    • fixed all the known bugs from the last version and optimized the code a bit
  • 1.2a
    • fixed a small bug where the admins with immunity could still be kicked when more than hobo_afk_spectator_kick player connect
IF YOU CANNOT COMPILE LOCALLY THEN DOWNLOAD THE .AMXX FILE AND DO NOT BUG ME ABOUT IT.
Attached Files
File Type: sma Get Plugin or Get Source (hobo_afk_manager.sma - 14554 views - 9.6 KB)
__________________

Last edited by bmann_420; 03-15-2009 at 15:49. Reason: Removed .amxx file
hoboman is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-07-2008 , 20:04   Re: Hobo AFK Management
Reply With Quote #2

You can detect spawn better with hamsandwich:
Code:
RegisterHam(Ham_Spawn, "player", "fwd_Ham_Spawn_post", 1); // ... public fwd_Ham_Spawn_post(id) {     // player spawned }

and you can get rid of the cstrike module with this:

Code:
#include <fakemeta> #define OFFSET_TEAM   114 #define OFFSET_INTERNALMODEL        126 enum CsInternalModel {     CS_DONTCHANGE = 0,     CS_CT_URBAN = 1,     CS_T_TERROR = 2,     CS_T_LEET = 3,     CS_T_ARCTIC = 4,     CS_CT_GSG9 = 5,     CS_CT_GIGN = 6,     CS_CT_SAS = 7,     CS_T_GUERILLA = 8,     CS_CT_VIP = 9,     CZ_T_MILITIA = 10,     CZ_CT_SPETSNAZ = 11 }; enum CsTeams {     CS_TEAM_UNASSIGNED = 0,     CS_TEAM_T = 1,     CS_TEAM_CT = 2,     CS_TEAM_SPECTATOR = 3 }; stock fm_set_user_team(id, {CsTeams,_}:team, {CsInternalModel,_}:model = CS_DONTCHANGE) {     set_pdata_int(id, OFFSET_TEAM, _:team);     if(model)     {         set_pdata_int(id, OFFSET_INERNALMODEL, _:model);     }     dllfunc(DLLFunc_ClientUserInfoChanged, id);     new teaminfo[32];     switch(team)     {         case TEAM_UNASSIGNED: copy(teaminfo, 31, "UNASSIGNED")         case TEAM_T: copy(teaminfo, 31, "TERRORIST")         case TEAM_CT: copy(teaminfo, 31, "CT")         case TEAM_SPECTATOR: copy(teaminfo, 31, "SPECTATOR")             }         static iMsgid_TeamInfo;     if(!iMsgid_TeamInfo)     {         iMsgid_TeamInfo = get_user_msgid("TeamInfo");     }     message_begin(MSG_ALL, iMsgid_TeamInfo);     write_byte(id);     write_string(teaminfo);     message_end(); } stock CsTeams:cs_get_user_team(index, &{CsInternalModel,_}:model = CS_DONTCHANGE) {     model = CsInternalModel:get_pdata_int(id, OFFSET_INTERNALMODEL);         return CsTeams:get_pdata_int(index, OFFSET_TEAM); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Pokemon
Senior Member
Join Date: Mar 2008
Old 04-07-2008 , 20:13   Re: Hobo AFK Management
Reply With Quote #3

Thank i am need too this plugin
__________________
Pokemon is offline
hoboman
Senior Member
Join Date: Jul 2007
Old 04-07-2008 , 20:13   Re: Hobo AFK Management
Reply With Quote #4

Yes, I saw VEN's tutorial too, but I don't want to use hamsandwich until the web compiler is updated and until it gets more popular with the other plugin writers

As for the cstrike module thing. I don't think it is necessary to convert the cstrike calls to fakemeta because this plugin is meant to be strictly for CS as I already explained in the introduction. If there is a reason why I should convert then please do tell me.
__________________
hoboman is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-07-2008 , 20:20   Re: Hobo AFK Management
Reply With Quote #5

You don't need the cstrike module for it to be strictly for CS.
Also, I'm sure fakemeta would use less resources, otherwise the conversion wouldn't have been made.
And you don't want to use a better spawn detecting method because it doesn't pre-compile for people who can't compile themselves?
Just slap a 1.8 version warning on there along with a tutorial on how to compile locally.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
bmann_420
AMX_Super Pooper
Join Date: Jan 2005
Location: [SuperCentral.co]
Old 04-08-2008 , 00:40   Re: Hobo AFK Management
Reply With Quote #6

ANd also it will be updated pretty soon
(lol @ the hobo_ cvars)
__________________
bmann_420 is offline
hazard1337
Senior Member
Join Date: Sep 2006
Old 04-09-2008 , 17:35   Re: Hobo AFK Management
Reply With Quote #7

@X-olent: You know even with a warning 1.8 only and tutorial on local compiling people will STILL complain about not getting it to work.

@Hobo (lol at cvars too): Nice plugin, looks very effective
__________________
[IMG]http://img139.**************/img139/1530/2sejaewg1.gif[/IMG]
If you +/- my K, leave your name.
I do not take requests VIA PM
Click on this before requesting/suggesting
This is your best friend
hazard1337 is offline
Send a message via Skype™ to hazard1337
niFe
Senior Member
Join Date: Apr 2008
Location: Planet Green
Old 04-11-2008 , 15:39   Re: Hobo AFK Management
Reply With Quote #8

I'm gonna try this out THnx hobo

oh and btw.. I'm planning to use this on my soccerjam server i was wondering if the afk plugin knows about the BOTS that are in T and CT.
Wouldnt the bots be treated like other players and be moved to spec?
I dont want that....
Thnx

-edit
wow works good Thanks! Very effective and efficient

Last edited by niFe; 04-12-2008 at 01:01. Reason: works good
niFe is offline
Eismann1976
Senior Member
Join Date: Feb 2006
Old 04-12-2008 , 15:47   Re: Hobo AFK Management
Reply With Quote #9

Works fine but one bug.

Player who joins the server and stay in MOTD or not choose a class will not be kicked.
__________________

Last edited by Eismann1976; 04-12-2008 at 15:50.
Eismann1976 is offline
Send a message via ICQ to Eismann1976
niFe
Senior Member
Join Date: Apr 2008
Location: Planet Green
Old 04-12-2008 , 17:41   Re: Hobo AFK Management
Reply With Quote #10

oh does it? didnt check that... notify me if it does...

-edit
hobo did u modify the old one? those bugs and all..
cause im planning to use the old one and it probably still has that bug not kicking ppl on motd.
__________________

Last edited by niFe; 04-15-2008 at 01:37.
niFe 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 04:32.


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