Raised This Month: $51 Target: $400
 12% 

Solved Remember disconnected player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-19-2019 , 12:18   Re: Remember disconnected player
Reply With Quote #11

I made a slight tweak to this to put a threshold (cvar) on after how many seconds they are considered reconnecting. So if a player reconnects between 0 and 30 seconds, it's considered a reconnect, beyond 30 seconds is not.
PHP Code:

#include <amxmodx>

new Trie:g_tReconnect;
new 
g_szAuthIDMAX_PLAYERS ][ 34 ];
new 
g_pReconnectSecs;

public 
plugin_init()
{
    
register_plugin"Player Reconnect Reason" "0.2" "SmileY" );
    
    
g_pReconnectSecs register_cvar"pr_secondthreshold" "30" );
    
g_tReconnect TrieCreate();
}

public 
plugin_end()
{
    
TrieDestroyg_tReconnect );
}

public 
client_disconnect(id)
{
    
TrieSetCellg_tReconnect g_szAuthIDid ] , get_systime() );
}

public 
client_putinserverid )
{
    new 
iLeaveTime;
    
get_user_authidid g_szAuthIDid ] , charsmaxg_szAuthID[] ) );
    
    if ( 
TrieGetCellg_tReconnect g_szAuthIDid ] , iLeaveTime ) )
    {
        if ( ( 
get_systime() - iLeaveTime ) <= get_pcvar_numg_pReconnectSecs ) )
        {
            
server_print"%d" , ( get_systime() - iLeaveTime ) );
            
set_task5.0 ,"SHOW_Message" id );
        }
    }
}

public 
SHOW_Messageid )
{
    if ( 
is_user_connectedid ) )
    {
        new 
szName32 ];
        
get_user_nameid szName charsmaxszName ) );
        
TrieDeleteKeyg_tReconnect g_szAuthIDid ] );
        
        
client_printprint_chat "[RETRY BOT] %s reconnected to server!" szName );
    }

__________________

Last edited by Bugsy; 12-19-2019 at 12:18.
Bugsy is offline
 



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:41.


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