Raised This Month: $ Target: $400
 0% 

remove


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-23-2020 , 21:36   Re: CT AFK Slayer
Reply With Quote #11

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];
    }

__________________

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

I Tested right now, and this don't slay my players..
Cirovic is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-24-2020 , 08:23   Re: CT AFK Slayer
Reply With Quote #13

BUgsy this dont slay my players
Cirovic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 10:25   Re: CT AFK Slayer
Reply With Quote #14

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.
__________________

Last edited by Bugsy; 04-24-2020 at 10:26.
Bugsy is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-24-2020 , 12:17   Re: CT AFK Slayer
Reply With Quote #15

So what should we do
Cirovic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 12:34   Re: CT AFK Slayer
Reply With Quote #16

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
__________________
Bugsy is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-24-2020 , 13:35   Re: CT AFK Slayer
Reply With Quote #17

okay bro pls do it today im in trouble
Cirovic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 13:45   Re: CT AFK Slayer
Reply With Quote #18

You got it, chief
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2020 , 17:44   Re: CT AFK Slayer
Reply With Quote #19

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] ) );

__________________
Bugsy is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-24-2020 , 18:46   Re: CT AFK Slayer
Reply With Quote #20

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
Cirovic 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 13:47.


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