AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   remove (https://forums.alliedmods.net/showthread.php?t=323561)

JocAnis 04-24-2020 19:20

Re: CT AFK Slayer
 
then i guess no need for checking origin but pev_v_angle

Bugsy 04-24-2020 19:23

Re: CT AFK Slayer
 
I don't know what that means, Cirovic

Cirovic 04-24-2020 20:38

Re: CT AFK Slayer
 
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

Bugsy 04-24-2020 20:40

Re: CT AFK Slayer
 
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 );
        }
    }



Cirovic 04-24-2020 22:47

Re: CT AFK Slayer
 
Should max_players be defined?

Bugsy 04-24-2020 22:50

Re: CT AFK Slayer
 
Done. I use 1.9 which it's defined for already, you should upgrade.

Carrion 04-24-2020 22:59

Re: CT AFK Slayer
 
@Bugsy can u make it for any player? its for CT only

Bugsy 04-24-2020 23:04

Re: CT AFK Slayer
 
Quote:

Originally Posted by Carrion (Post 2696084)
@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" );

Carrion 04-24-2020 23:56

Re: CT AFK Slayer
 
Quote:

Originally Posted by Bugsy (Post 2696086)
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

Bugsy 04-25-2020 00:04

Re: CT AFK Slayer
 
You misspelled moved
You should add a slaysnumber reset to 0 at client_connect()
Use charsmax() in get_user_name() instead of 32


All times are GMT -4. The time now is 09:01.

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