This is what I wrote after you PMed me. I haven't tested it but it should work quite accurately to what you want.
Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#define AFK_KICK_TIME 5.0
#define TIME_UNTOUCHED 3.0
#define m_LastHitGroup 75
enum ( += 32 )
{
TASK_KICK = 1000,
TASK_SUBCHECK
}
new Float: g_flLastHitTime[ 33 ];
public plugin_init()
{
RegisterHam( Ham_TakeDamage, "player", "ham_TakeDamage_Post", 1 );
}
public client_disconnect( id )
{
remove_task( id + TASK_KICK );
remove_task( id + TASK_SUBCHECK );
}
public ham_TakeDamage_Post( iVictim, iInflictor, iAttacker )
{
if( iAttacker && cs_get_user_team( iAttacker ) == CS_TEAM_CT && cs_get_user_team( iVictim ) == CS_TEAM_T
&& get_pdata_int( iVictim, m_LastHitGroup ) == HIT_HEAD )
{
static Float: flVelocity[ 3 ];
pev( iVictim, pev_velocity, flVelocity );
if( vector_length( flVelocity ) < 1.0 )
{
g_flLastHitTime[ iVictim ] = get_gametime();
if( !task_exists( iVictim + TASK_KICK ) )
{
set_task( AFK_KICK_TIME, "task_Kick", iVictim + TASK_KICK );
set_task( 0.2, "task_SubCheck", iVictim + TASK_SUBCHECK );
}
}
}
}
public task_SubCheck( id )
{
static Float: flVelocity[ 3 ];
pev( id, pev_velocity, flVelocity );
if( vector_length( flVelocity ) > 0.0 || get_gametime() - g_flLastHitTime[ id ] > TIME_UNTOUCHED )
{
remove_task( id + TASK_KICK );
remove_task( id + TASK_SUBCHECK );
}
else set_task( 0.2, "task_SubCheck", id + TASK_SUBCHECK );
}
public task_Kick( id )
{
id -= TASK_KICK;
server_cmd( "kick #%i ^"Inactive for too long!^"", get_user_userid( id ) );
}
__________________