Raised This Month: $ Target: $400
 0% 

Check times help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 06-28-2012 , 11:01   Re: Check times help
Reply With Quote #2

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 ) ); }
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 06-28-2012 at 11:02.
hornet is offline
 



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 06:05.


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