Raised This Month: $ Target: $400
 0% 

remove


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Carrion
Member
Join Date: Mar 2020
Old 04-25-2020 , 00:17   Re: CT AFK Slayer
Reply With Quote #1

Quote:
Originally Posted by Bugsy View Post
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
Carrion is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2020 , 00:21   Re: CT AFK Slayer
Reply With Quote #2

[AMXX] %s was MOVIED to spectator for AFK.
__________________
Bugsy is offline
Carrion
Member
Join Date: Mar 2020
Old 04-25-2020 , 00:28   Re: CT AFK Slayer
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
[AMXX] %s was MOVIED to spectator for AFK.
i dunno so good just learning
cant find mistake
Carrion is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2020 , 00:30   Re: CT AFK Slayer
Reply With Quote #4

it's MOVED not MOVIED
__________________
Bugsy is offline
Carrion
Member
Join Date: Mar 2020
Old 04-25-2020 , 00:32   Re: CT AFK Slayer
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
it's MOVED not MOVIED
gramar mistake i thinked in code is mistake
tnx a lot {3

Last edited by Carrion; 04-25-2020 at 00:32.
Carrion is offline
lantimilan
Senior Member
Join Date: May 2016
Old 04-25-2020 , 02:52   Re: CT AFK Slayer
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
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

Last edited by lantimilan; 04-25-2020 at 02:56.
lantimilan is offline
Send a message via MSN to lantimilan
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-25-2020 , 06:52   Re: CT AFK Slayer
Reply With Quote #7

gj bugsy. now all deathrun servers have a fix, just to find this thread
__________________
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-25-2020 , 11:47   Re: CT AFK Slayer
Reply With Quote #8

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

__________________

Last edited by Bugsy; 04-25-2020 at 14:43.
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-25-2020 , 12:02   Re: CT AFK Slayer
Reply With Quote #9

Made a few fixes
__________________
Bugsy is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 04-25-2020 , 14:21   Re: CT AFK Slayer
Reply With Quote #10

bugsy thanks a lot can you please go check your msg in inbox from me
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 09:01.


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