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)

Bugsy 04-23-2020 21:36

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



Cirovic 04-24-2020 08:23

Re: CT AFK Slayer
 
I Tested right now, and this don't slay my players..

Cirovic 04-24-2020 08:23

Re: CT AFK Slayer
 
BUgsy this dont slay my players

Bugsy 04-24-2020 10:25

Re: CT AFK Slayer
 
Ok I see the issue.. the problem is with players who go AFK after leaving spawn. I'll need to change the logic a bit to make it work with the correct seconds interval. They will eventually get slayed, but in some cases in double the defined cvar seconds.

Cirovic 04-24-2020 12:17

Re: CT AFK Slayer
 
So what should we do

Bugsy 04-24-2020 12:34

Re: CT AFK Slayer
 
I will fix this for you so that it checks people in real-time, not only in 30 second intervals. This will make it work more accurately and how you want

Cirovic 04-24-2020 13:35

Re: CT AFK Slayer
 
okay bro pls do it today im in trouble

Bugsy 04-24-2020 13:45

Re: CT AFK Slayer
 
You got it, chief

Bugsy 04-24-2020 17:44

Re: CT AFK Slayer
 
Try this
PHP Code:


#include <amxmodx> 
#include <fakemeta>

new const Version[] = "0.3";

const 
TaskID 324123;

enum PlayerData
{
    
Float:PreviousOrigin],
    
LastMoveTime
}

new 
g_PlayerDataMAX_PLAYERS ][ PlayerData ];  
new 
g_pSlayTime;

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

    
g_pSlayTime register_cvar"as_slaytime" "30" );
    
    
set_task1.0 "CheckAFK" TaskID , .flags="b" );
}  

public 
client_connectid )
{
    
g_PlayerDataid ][ LastMoveTime ] = 0;
}

public 
CheckAFK()  
{  
    new 
iPlayers32 ] , iNum iPlayer Float:fOrigin] , iSysTime;
        
    
get_playersiPlayers iNum "ae" "CT" );
    
iSysTime get_systime();
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        
peviPlayer pev_origin fOrigin );
        
        if ( 
g_PlayerDataiPlayer ][ LastMoveTime ] && !PlayerMovedfOrigin g_PlayerDataiPlayer ][ PreviousOrigin ] ) )
        {
            if ( ( 
iSysTime g_PlayerDataiPlayer ][ LastMoveTime ] ) >= get_pcvar_numg_pSlayTime ) ) 
                
user_killiPlayer )
        }
        else
        {
            
g_PlayerDataiPlayer ][ LastMoveTime ] = iSysTime;
        }
        
        
g_PlayerDataiPlayer ][ PreviousOrigin ][ ] = fOrigin];
        
g_PlayerDataiPlayer ][ PreviousOrigin ][ ] = fOrigin];
        
g_PlayerDataiPlayer ][ PreviousOrigin ][ ] = fOrigin];
    }
}

bool:PlayerMovedFloat:fPos1[] , Float:fPos2[] )
{
    return 
bool:( ( fPos1] != fPos2] ) || ( fPos1] != fPos2] ) );



Cirovic 04-24-2020 18:46

Re: CT AFK Slayer
 
Plugin do the job, but does not kill the players that map is moving to the dead spot.. so basically it does not kill the afk players xd


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

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