View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-08-2020 , 21:12   Re: Disconnect Reason
Reply With Quote #92

This plugin is no longer needed if you are running AMX-X 1.9. client_disconnected() provides the same functionality.

PHP Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init() 
{
    
register_plugin"Notify Admin on Disconnect" "0.1" "bugsy" );
}

public 
client_disconnectedid bool:bDrop , const szMsg[] , )
{
    new 
iPlayers32 ] , iNum iPlayer szName32 ];
    
    
get_players_exiPlayers iNum GetPlayers_ExcludeBots GetPlayers_ExcludeHLTV );
    
get_user_nameid szName charsmaxszName ) );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        if ( 
get_user_flagsiPlayer ) & ADMIN_BAN )
        {
            
client_printiPlayer print_chat "* %s disconnected [%s]" szName szMsg] == EOS "N\A" szMsg );
        }
    }

If you do not want to run 1.9
PHP Code:
#include <amxmodx>

new const Version[] = "0.1";

public 
plugin_init() 
{
    
register_plugin"Disconnect Reason Example" Version "bugsy" );
}

public 
client_disconnect_reasonid ReasonCodes:drReason , const szReason[] )
{
    new 
iPlayers32 ] , iNum iPlayer szName32 ];
    
    
get_playersiPlayers iNum "ch" );
    
get_user_nameid szName charsmaxszName ) );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        if ( 
get_user_flagsiPlayer ) & ADMIN_BAN )
        {
            
client_printiPlayer print_chat "* %s disconnected [%s]" szName szReason] == EOS "N\A" szReason );
        }
    }
    

__________________

Last edited by Bugsy; 01-08-2020 at 22:13.
Bugsy is offline