Raised This Month: $ Target: $400
 0% 

remove


Post New Thread Reply   
 
Thread Tools Display Modes
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-24-2020 , 19:20   Re: CT AFK Slayer
Reply With Quote #21

then i guess no need for checking origin but pev_v_angle
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)
JocAnis is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 19:23   Re: CT AFK Slayer
Reply With Quote #22

I don't know what that means, Cirovic
__________________

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

Plugin slay players that does not move, but map have on spawn move platform that will kill players that dont play, and plugin dont detect that and wont kill player bcs he moves bcs of map
Cirovic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 20:40   Re: CT AFK Slayer
Reply With Quote #24

Edit: This detects AFK by monitoring button presses instead of player location.

PHP Code:

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

new const Version[] = "0.4";

#define MAX_PLAYERS 32

const ButtonBits = ( IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT IN_JUMP IN_DUCK IN_USE IN_ATTACK IN_ATTACK2 IN_SCORE );

new 
g_LastMoveTimeMAX_PLAYERS ];  
new 
g_iSysTime;
new 
g_pSlayTime;
new 
g_pFreezeTime;
new 
bool:g_bInRound;

public 
plugin_init()  
{  
    
register_plugin"AFK Slay" Version "bugsy" );

    
g_pSlayTime register_cvar"as_slaytime" "30" );
    
g_pFreezeTime get_cvar_pointer"mp_freezetime" );
    
    
RegisterHamHam_Spawn "player" "HamSpawn_Post" true );
    
register_forwardFM_CmdStart "CmdStart" );
    
register_logevent"RoundStart" "1=Round_Start" );
    
register_logevent"RoundEnd" "1=Round_End" );
    
    
set_task1.0 "CheckAFK" , .flags="b" );
}  

public 
HamSpawn_PostiPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
        
g_LastMoveTimeiPlayer ] = g_iSysTime + ( g_bInRound get_pcvar_numg_pFreezeTime ) );
    }
}

public 
RoundStart()
{
    
g_bInRound true;
}

public 
RoundEnd()
{
    
g_bInRound false;
}

public 
CmdStartid handle seed )
{
    if ( 
g_bInRound && ( get_uchandle UC_Buttons ) & ButtonBits ) )
    {
        
g_LastMoveTimeid ] = g_iSysTime;
    }
}  

public 
CheckAFK()  
{  
    new 
iPlayers32 ] , iNum iPlayer;
        
    
g_iSysTime get_systime();
    
    
get_playersiPlayers iNum "ae" "CT" );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        if ( 
g_LastMoveTimeiPlayer ] && ( ( g_iSysTime g_LastMoveTimeiPlayer ] ) >= get_pcvar_numg_pSlayTime ) ) )
        {
            
user_killiPlayer );
        }
    }

__________________

Last edited by Bugsy; 04-24-2020 at 22:50.
Bugsy is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-24-2020 , 22:47   Re: CT AFK Slayer
Reply With Quote #25

Should max_players be defined?
Cirovic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 22:50   Re: CT AFK Slayer
Reply With Quote #26

Done. I use 1.9 which it's defined for already, you should upgrade.
__________________
Bugsy is offline
Carrion
Member
Join Date: Mar 2020
Old 04-24-2020 , 22:59   Re: CT AFK Slayer
Reply With Quote #27

@Bugsy can u make it for any player? its for CT only
Carrion is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 23:04   Re: CT AFK Slayer
Reply With Quote #28

Quote:
Originally Posted by Carrion View Post
@Bugsy can u make it for any player? its for CT only
Just replace

get_players( iPlayers , iNum , "ae" , "CT" );

with

get_players( iPlayers , iNum , "a" );
__________________
Bugsy is offline
Carrion
Member
Join Date: Mar 2020
Old 04-24-2020 , 23:56   Re: CT AFK Slayer
Reply With Quote #29

Quote:
Originally Posted by Bugsy View Post
Just replace

get_players( iPlayers , iNum , "ae" , "CT" );

with

get_players( iPlayers , iNum , "a" );
i also added moving to spect
please check need the code correction?

sma

Last edited by Carrion; 04-24-2020 at 23:56.
Carrion is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2020 , 00:04   Re: CT AFK Slayer
Reply With Quote #30

You misspelled moved
You should add a slaysnumber reset to 0 at client_connect()
Use charsmax() in get_user_name() instead of 32
__________________
Bugsy is offline
Reply



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 12:44.


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