Raised This Month: $ Target: $400
 0% 

Simple AFK Manager [ver. 2.3]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chaosmedia90
Member
Join Date: May 2009
Old 06-01-2010 , 11:14   Re: Simple AFK Manager [ver. 2.3]
Reply With Quote #1

make or no ..
__________________
chaosmedia90 is offline
C63
Junior Member
Join Date: May 2010
Old 10-12-2010 , 05:00   Re: Simple AFK Manager [ver. 2.3]
Reply With Quote #2

afk_immunity_flag (default: b): what flag must have user to not be kicked.

This cvar is not working, please fix it.
C63 is offline
Djirko
New Member
Join Date: Oct 2010
Old 10-18-2010 , 02:55   Re: Simple AFK Manager [ver. 2.3]
Reply With Quote #3

it always shows me that 40 seconds left till kick.
Djirko is offline
-=hunter=-
Senior Member
Join Date: Jul 2008
Old 11-03-2010 , 07:20   Re: Simple AFK Manager [ver. 2.3]
Reply With Quote #4

Fixed version. In this version players will not kick on new round.
Also fixed lines
PHP Code:
|| (is_user_bot(i) && kick_bot)
|| (
is_user_hltv(i) && kick_hltv)) 
to
PHP Code:
|| (!kick_bot && is_user_bot(i))
|| (!
kick_hltv && is_user_hltv(i))) 
PHP Code:
/* 
Plugin: Simple AFK Manager
Version: 2.3
© [gm-project.net] #Staff.
// Fixed by hunter

Support on alliedmods.net: http://forums.alliedmods.net/showthread.php?t=110536
Support on gm-project.net: http://gm-community.net/showthread.php?t=581
*/

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Simple AFK Manager"
#define VERSION "2.3"
#define AUTHOR "[gm-project.net] #Staff"

#define MAX_PLAYERS 32

#define PREFIX "SAM"

#define OFFSET_LAST_MOVEMENT 124

new g_maxplayers

new Float:g_spec_time[MAX_PLAYERS+1]

new 
g_Reasong_aTimeg_sTimeg_Reportg_Info
new g_Immunityg_kickBotsg_kickHLTVg_showMsg
new g_afkCount[2]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_maxplayers get_maxplayers()
    
    
g_Reason register_cvar("afk_kick_reason""AFK")
    
g_aTime register_cvar("afk_time""60.0")
    
g_sTime register_cvar("afk_spec_time""180.0")
    
g_Report register_cvar("afk_report""2")
    
g_showMsg register_cvar("afk_showmsg""1")
    
g_Info register_cvar("afk_info_time""20.0")
    
g_Immunity register_cvar("afk_immunity_flag""b")
    
g_kickBots register_cvar("afk_kick_bots""0")
    
g_kickHLTV register_cvar("afk_kick_hltv""0")

    
register_dictionary("sam.txt")

    
register_event("HLTV""event_new_round""a""1=0""2=0"
    
    
register_cvar("sam_version"VERSIONFCVAR_SERVER FCVAR_SPONLY)
    
set_task(10.0"checkAFK"___"b")
    
register_logevent("RoundStart"2"1=Round_Start")
}

public 
client_putinserver(id) {
    
g_spec_time[id] = 0.0
}

public 
event_new_round()
{
    new 
Float:gametime get_gametime()    
    for (new 
1<= g_maxplayersi++)
    {
        if ( 
is_user_connected(i) )
            
set_pdata_float(iOFFSET_LAST_MOVEMENTgametime)
    }
    return 
PLUGIN_CONTINUE
}

public 
RoundStart()
{
    if ( 
get_pcvar_num(g_showMsg) ) {
        
client_print(0print_chat"[%s] %L"PREFIXLANG_PLAYER"AFK_MSG"g_afkCount[1], g_afkCount[0])
    }
}

public 
checkAFK() {
    new 
Float:afk_time get_pcvar_float(g_aTime)
    new 
Float:afk_spec_time get_pcvar_float(g_sTime)
    new 
Float:afk_info_time get_pcvar_float(g_Info)
    new 
iFloat:cur_timeteamFloat:lastActivity
    g_afkCount
[0] = g_afkCount[1] = 0
    
new strFlag[20]
    
get_pcvar_string(g_ImmunitystrFlag19)
    new 
flag read_flags(strFlag)
    
cur_time get_gametime()
    if (
afk_time)
        
afk_time cur_time afk_time
    
if (afk_spec_time)
        
afk_spec_time cur_time afk_spec_time
    
if (afk_info_time)
        
afk_info_time cur_time afk_info_time
    
    
new kick_bot get_pcvar_num(g_kickBots)
    new 
kick_hltv get_pcvar_num(g_kickHLTV)
    
    for (
1<= g_maxplayersi++)
    {
        if (!
is_user_connected(i) || (get_user_flags(i) & flag
        || (!
kick_bot && is_user_bot(i))
        || (!
kick_hltv && is_user_hltv(i)))
                continue
                
        
team get_user_team(i)
        if (
<= team <= 2)
               {
                   if (!
is_user_alive(i) || !afk_time)
                         continue
            
g_spec_time[i] = 0.0
            lastActivity 
get_pdata_float(iOFFSET_LAST_MOVEMENT)
            if (
lastActivity afk_time)
                
kickAFK(i)
            else
            {
                if (
lastActivity afk_info_time) {
                    
client_print(iprint_chat"[%s] %L"PREFIXLANG_PLAYER"AFK_WARN"floatround(afk_info_time afk_time))
                    
g_afkCount[team 1] ++
                }
            }
        }
        else
        {
            if (!
afk_spec_time)
                continue
            if (!
g_spec_time[i])
                
g_spec_time[i] = cur_time
            
else
            if (
g_spec_time[i] < afk_spec_time)
                
kickAFK(i)
        }
        
    }
}

public 
kickAFK(id) {
    new 
name[32], reason[128], report
    
    get_user_name
(idname31)
    
get_pcvar_string(g_Reasonreason127)
    
report get_pcvar_num(g_Report)
    
    
message_beginMSG_ONESVC_DISCONNECT_id )
    
write_stringreason )
    
message_end( )
    
server_exec()
    
    if (
report == 2)
        
client_print(0print_chat"[%s] %L"PREFIXLANG_PLAYER"AFK_KICK"name)
    else
    if (
report == 1) {
        for (
report 1report <= g_maxplayersreport++)
        {
            if (
get_user_flags(report) & ADMIN_CHAT)
                
client_print(reportprint_chat"[%s] %L"PREFIXLANG_PLAYER"AFK_KICK"name)
        }
    }
    

-=hunter=- is offline
Send a message via ICQ to -=hunter=- Send a message via Skype™ to -=hunter=-
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 11-13-2012 , 01:48   Re: Simple AFK Manager [ver. 2.3]
Reply With Quote #5

I've made some fixes of that crap:
- fixed informing AFKer about remaining time before kick. Attention! CVar afk_info_time actually sets delay before AFKer gets informed about how many time left before kick.
- fixed wrong team detection (urgent for players who switched to spectators)
- removed cvars afk_kick_bots & afk_kick_hltv because it is stupid to kick bots & HLTV for AFKing.
- fixed kicks players who were dead at new round (in better way)
- corrected ru & en translations

Plugin has 2 interesting features. It uses other way to detect AFKing (not by player origin) so it can 'detect' jumps without moving. And (now) it can detect AFKers who were killed last round.

I believe after my fixes plugin could be approved.

Plugin could only be used in CS.

--
update
SMA was reuploaded (my mistake corrected).
Added version with colorchat (in ML full color settings are defined only for en & ru languages).

--
Attached Files
File Type: txt sam.txt (2.1 KB, 318 views)
File Type: sma Get Plugin or Get Source (sam.sma - 805 views - 4.2 KB)
File Type: zip sam_colorchat.zip (4.2 KB, 145 views)
__________________

Last edited by isotonic; 11-14-2012 at 01:17.
isotonic 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 20:11.


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