Thread: remove
View Single Post
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-23-2020 , 17:25   Re: CT AFK Slayer
Reply With Quote #2

Quote:
Originally Posted by Cirovic View Post
Hello, i need plugin that will slay AFK CT Players, i searched forum and there is no plugin that matches my criterium, so if anyone want to create me this plugin.. thank you..

*Important
i have deathrun server, and on some maps there is afk slayer that moves players in hole to die, and when i tried some afk slayers that moving thing will confuse plugin, like that is player movement.. i hope u understand.. thanks again

AFK TIME = 30
TEAM = ONLY CT
PHP Code:
#include <amxmodx>  
#include <cstrike>
#include <amxmisc>  
#include <hamsandwich>  
#include <fakemeta>  

#define TIME 30.0  

new Float:player_origin[33][3];  

public 
plugin_init()  
{  
    
RegisterHam(Ham_Spawn"player""e_Spawn"1);  
}  

public 
e_Spawn(id)  
{
    if(
get_user_team(id) != 2)
        return;
    
remove_task(id)  
    
    if(
is_user_alive(id))  
    {  
        
set_task(0.8"get_spawn"id);  
    }
}  

public 
get_spawn(id)  
{
    
pev(idpev_originplayer_origin[id]);  
    
set_task(TIME"check_afk"id);  
}  

public 
check_afk(id)  
{  
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
    {  
        if(
same_origin(id))  
        {  
            
user_kill(id);  
            new 
name[33];  
            
get_user_name(idname32);  
            
client_print(0print_chat,  "%s was killed for AFK."name);
        }  
    }  
}  

public 
same_origin(id)  
{  
    new 
Float:origin[3];  
    
pev(idpev_originorigin);  
    for(new 
03i++)  
        if(
origin[i] != player_origin[id][i])  
        return 
0;  
    return 
1;  

Supremache is offline