Raised This Month: $ Target: $400
 0% 

remove


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2020 , 21:36   Re: CT AFK Slayer
Reply With Quote #1

No, the above only covers when he spawns and does not move.

This will slay when a player spawns and does not move, or stops moving for 30 seconds anywhere on the map.
PHP Code:

#include <amxmodx> 
#include <fakemeta>
#include <hamsandwich>

new const Version[] = "0.2";

const 
TaskID 324123;

new 
Float:g_fPrevOriginMAX_PLAYERS ][ ];  
new 
g_pSlayTime;

public 
plugin_init()  
{  
    
register_plugin"AFK Slay" Version "bugsy" );
    
    
register_logevent"RoundStart" "1=Round_Start" );
    
register_logevent"RoundEnd" "1=Round_End" );

    
g_pSlayTime register_cvar"as_slaytime" "30" );
}  

public 
client_connectid )
{
    
g_fPrevOriginid ][ ] = 0.0;
}

public 
RoundStart()
{
    new 
iPlayers32 ] , iNum iPlayer;
    
    
get_playersiPlayers iNum "ae" "CT" );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
peviPlayer pev_origin g_fPrevOriginiPlayer ] );
    }
    
    
set_taskget_pcvar_floatg_pSlayTime ) , "CheckAFK" TaskID , .flags="b" );
}

public 
RoundEnd()
{
    
remove_taskTaskID );
}

public 
CheckAFK()  
{  
    new 
iPlayers32 ] , iNum iPlayer Float:fOrigin];
        
    
get_playersiPlayers iNum "ae" "CT" );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        
peviPlayer pev_origin fOrigin );
        
        if ( 
g_fPrevOriginiPlayer ][ ] && ( get_distance_ffOrigin g_fPrevOriginiPlayer ] ) <= 25.0 ) )
        {
            
user_killiPlayer )
        }    
        
        
g_fPrevOriginiPlayer ][ ] = fOrigin];
        
g_fPrevOriginiPlayer ][ ] = fOrigin];
        
g_fPrevOriginiPlayer ][ ] = fOrigin];
    }

__________________

Last edited by Bugsy; 04-23-2020 at 22:16.
Bugsy 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 09:01.


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