Raised This Month: $12 Target: $400
 3% 

remove


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-22-2020 , 13:30   remove
Reply With Quote #1

lock

Last edited by Cirovic; 07-09-2022 at 14:07.
Cirovic is offline
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
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-23-2020 , 19:32   Re: CT AFK Slayer
Reply With Quote #3

thanks, but that doesn't kill my afk players.
Cirovic is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-23-2020 , 19:54   Re: CT AFK Slayer
Reply With Quote #4

Perhaps you need to detect and count when the button is not pressed.
I'm thinking about it, But someone will complete it before I make it.
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2020 , 19:58   Re: CT AFK Slayer
Reply With Quote #5

This will slay if the player is within 10 units of where he spawned after 30 seconds.
PHP Code:

#include <amxmodx> 
#include <fakemeta>

new const Version[] = "0.1";

const 
TaskID 3412231;

new 
Float:g_fOriginMAX_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 
RoundStart()  
{
    new 
iPlayers32 ] , iNum iPlayer;
        
    
get_playersiPlayers iNum "ae" "CT" );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
peviPlayer pev_origin g_fOriginiPlayer ] );
    }
    
    
set_taskget_pcvar_floatg_pSlayTime ) , "CheckAFK" TaskID );
}  

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 ( 
get_distance_fg_fOriginiPlayer ] , fOrigin ) <= 10.0 )
            
user_killiPlayer )
    }

__________________

Last edited by Bugsy; 04-23-2020 at 19:58.
Bugsy is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-23-2020 , 20:01   Re: CT AFK Slayer
Reply With Quote #6

What about if player doesn't move from spawn point will he be slayed??
Cirovic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2020 , 20:03   Re: CT AFK Slayer
Reply With Quote #7

Yes, if the player does nothing he will be killed after 30 seconds. With the 10 unit thing, if he walked away and then came back and was within 10 units of his spawn location, he would be slayed. Odds are slim, but I guess it could happen. I can add additional code to prevent this.
__________________

Last edited by Bugsy; 04-23-2020 at 20:04.
Bugsy is offline
+ARUKARI-
AlliedModders Donor
Join Date: Jul 2004
Location: Japan
Old 04-23-2020 , 20:11   Re: CT AFK Slayer
Reply With Quote #8

@Bugsy
You work fast everyday. I think you so busy.
__________________
GitHub
SteamWishlist

六四天安門事件
+ARUKARI- is offline
iclassdon
AlliedModders Donor
Join Date: May 2006
Old 04-23-2020 , 20:34   Re: CT AFK Slayer
Reply With Quote #9

Bugsy = Godlike =)
iclassdon is offline
Send a message via MSN to iclassdon
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-23-2020 , 21:28   Re: CT AFK Slayer
Reply With Quote #10

Bugsy what about if he go far from spawn and afk there will he be slayed?
Cirovic 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 10:56.


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