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)

Cirovic 04-22-2020 13:30

remove
 
lock

Supremache 04-23-2020 17:25

Re: CT AFK Slayer
 
Quote:

Originally Posted by Cirovic (Post 2695370)
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;  



Cirovic 04-23-2020 19:32

Re: CT AFK Slayer
 
thanks, but that doesn't kill my afk players.

+ARUKARI- 04-23-2020 19:54

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

Bugsy 04-23-2020 19:58

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



Cirovic 04-23-2020 20:01

Re: CT AFK Slayer
 
What about if player doesn't move from spawn point will he be slayed??

Bugsy 04-23-2020 20:03

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

+ARUKARI- 04-23-2020 20:11

Re: CT AFK Slayer
 
@Bugsy
You work fast everyday. I think you so busy. :)

iclassdon 04-23-2020 20:34

Re: CT AFK Slayer
 
Bugsy = Godlike =)

Cirovic 04-23-2020 21:28

Re: CT AFK Slayer
 
Bugsy what about if he go far from spawn and afk there will he be slayed?

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

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

Carrion 04-25-2020 00:17

Re: CT AFK Slayer
 
Quote:

Originally Posted by Bugsy (Post 2696100)
You misspelled moved
You should add a slaysnumber reset to 0 at client_connect()
Use charsmax() in get_user_name() instead of 32

sorry for bother :)
now?

sma

Bugsy 04-25-2020 00:21

Re: CT AFK Slayer
 
[AMXX] %s was MOVIED to spectator for AFK.

Carrion 04-25-2020 00:28

Re: CT AFK Slayer
 
Quote:

Originally Posted by Bugsy (Post 2696104)
[AMXX] %s was MOVIED to spectator for AFK.

i dunno so good :( just learning
cant find mistake :(

Bugsy 04-25-2020 00:30

Re: CT AFK Slayer
 
it's MOVED not MOVIED

Carrion 04-25-2020 00:32

Re: CT AFK Slayer
 
Quote:

Originally Posted by Bugsy (Post 2696106)
it's MOVED not MOVIED

gramar mistake i thinked in code is mistake :)
tnx a lot {3

lantimilan 04-25-2020 02:52

Re: CT AFK Slayer
 
Quote:

Originally Posted by Bugsy (Post 2696106)
it's MOVED not MOVIED

Hi bugsy, its possible to write one message in HUD when he kill to show all nick , he dont move for 30 sec and Slay ? i test your plugins working exellent in all maps, just for ct team for t dont work

JocAnis 04-25-2020 06:52

Re: CT AFK Slayer
 
gj bugsy. now all deathrun servers have a fix, just to find this thread :D

Bugsy 04-25-2020 11:47

Re: CT AFK Slayer
 
Not thoroughly tested. I am thinking chat may be better over HUD since the AFK HUDs can appear at random as people go AFK.

Cvars:
  • as_slaytime - Seconds until player is slayed. Default: 30
  • as_slaymode - 0=all, 1=T only, 2=CT only. Default: 2
  • as_spectatorslays - Number of slays until player moved to spectator. Players counter gets reset to 0 when the player moves. This would cover if the player got moved to spec but continued to be AFK, he'd get moved back right away. This makes it essentially work as a consecutive AFK move to spectator, instead of tracking instances in random rounds. Default: 5
  • as_verbosemode - 0=silent, 1=show HUD. Default: 1

PHP Code:


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

new const Version[] = "0.5";

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

enum PlayerData
{
    
LastMoveTime,
    
SlayCount
}

new 
g_pdDataMAX_PLAYERS ][ PlayerData ];  
new 
g_iSysTime bool:g_bInRound;
new 
g_pSlayTime g_pSlayMode g_pSpecSlays g_pVerboseMode g_pFreezeTime;

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

    
g_pSlayTime register_cvar"as_slaytime" "30" );
    
g_pSlayMode register_cvar"as_slaymode" "2" );
    
g_pSpecSlays register_cvar"as_spectatorslays" "5" );
    
g_pVerboseMode register_cvar"as_verbosemode" "1" );
    
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 
client_connectid )
{
    
g_pdDataid ][ SlayCount ] = 0;
}

public 
HamSpawn_PostiPlayer )
{
    if ( 
is_user_aliveiPlayer ) )
    {
        
g_pdDataiPlayer ][ LastMoveTime ] = 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_pdDataid ][ LastMoveTime ] = g_iSysTime;
        
g_pdDataid ][ SlayCount ] = 0;
    }
}  

public 
CheckAFK()  
{  
    new 
iPlayers32 ] , iNum iPlayer szName[32 ] , iSlayPos iSpecPos iVerbose;
    static 
szSlayNames512 ] , szSpecNames512 ];
    
    
iVerbose get_pcvar_numg_pVerboseMode );
    
g_iSysTime get_systime();
    
    switch ( 
get_pcvar_numg_pSlayMode ) )
    {
        case 
1get_playersiPlayers iNum "ae" "TERRORIST" );
        case 
2get_playersiPlayers iNum "ae" "CT" );
        default: 
get_playersiPlayers iNum "a" );
    }
    
    
szSlayNames] = EOS;
    
szSpecNames] = EOS;
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        if ( 
g_pdDataiPlayer ][ LastMoveTime ] && ( ( g_iSysTime g_pdDataiPlayer ][ LastMoveTime ] ) >= get_pcvar_numg_pSlayTime ) ) )
        {
            
user_killiPlayer );
            
            if ( 
iVerbose )
                
get_user_nameiPlayer szName charsmaxszName ) );
            
            if ( ++
g_pdDataiPlayer ][ SlayCount ]  >= get_pcvar_numg_pSpecSlays ) )
            {
                
cs_set_user_teamiPlayer CS_TEAM_SPECTATOR );
                
                if ( 
iVerbose )
                    
iSpecPos += formatexszSpecNamesiSpecPos ] , charsmaxszSpecNames ) - iSpecPos "%s^n" szName );
            }
            else
            {
                if ( 
iVerbose )
                    
iSlayPos += formatexszSlayNamesiSlayPos ] , charsmaxszSlayNames ) - iSlayPos "%s^n" szName );
            }
        }
    }
    
    if ( 
iVerbose && ( iSlayPos || iSpecPos ) )
    {
        
set_hudmessage255 255 255 0.05 0.3 0.0 3.0 );
        
show_hudmessage"%s%s%s%s" iSlayPos "AFK - Slayed:^n^n" "" szSlayNames iSpecPos "AFK - Slayed / Moved to Spec:^n^n" "" szSpecNames );
    }



Bugsy 04-25-2020 12:02

Re: CT AFK Slayer
 
Made a few fixes

Cirovic 04-25-2020 14:21

Re: CT AFK Slayer
 
bugsy thanks a lot can you please go check your msg in inbox from me


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

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