AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Hobo AFK Management ( FINAL ) (https://forums.alliedmods.net/showthread.php?t=69622)

hoboman 04-07-2008 18:50

Hobo AFK Management ( FINAL )
 
3 Attachment(s)
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.

Exolent[jNr] 04-07-2008 19:04

Re: Hobo AFK Management
 
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); }

Pokemon 04-07-2008 19:13

Re: Hobo AFK Management
 
Thank i am need too this plugin

hoboman 04-07-2008 19:13

Re: Hobo AFK Management
 
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.

Exolent[jNr] 04-07-2008 19:20

Re: Hobo AFK Management
 
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.

bmann_420 04-07-2008 23:40

Re: Hobo AFK Management
 
ANd also it will be updated pretty soon :D
(lol @ the hobo_ cvars)

hazard1337 04-09-2008 16:35

Re: Hobo AFK Management
 
@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

niFe 04-11-2008 14:39

Re: Hobo AFK Management
 
I'm gonna try this out :D 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 :D

Eismann1976 04-12-2008 14:47

Re: Hobo AFK Management
 
Works fine but one bug.

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

niFe 04-12-2008 16:41

Re: Hobo AFK Management
 
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.


All times are GMT -4. The time now is 04:33.

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