AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Player disconnected - HUD message for Admins only (https://forums.alliedmods.net/showthread.php?t=337151)

StDenisGamers 04-03-2022 19:39

Player disconnected - HUD message for Admins only
 
Hello.

I am looking for just a plugin that lets Admins only know via a HUD message when a player disconnects from the server. I know i can see it in the config but during gameplay its often nice not to constantly press the tab(scoreboard).

thanks in advance!

Supremache 04-03-2022 21:37

Re: Player disconnected - HUD message for Admins only
 
Quote:

Originally Posted by StDenisGamers (Post 2775760)
Hello.

I am looking for just a plugin that lets Admins only know via a HUD message when a player disconnects from the server. I know i can see it in the config but during gameplay its often nice not to constantly press the tab(scoreboard).

thanks in advance!

I'm not sure if it is possible to create a loop inside the 'client disconnected' function but try this and if it doesn't work I will use another method

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
}

public 
client_disconnectid )
{
    new 
iPlayer32 ], szName32 ], iNum;
    
get_playersiPlayeriNum"ch" )
    
get_user_nameidszNamecharsmaxszName ) )
    
    for( new 
iiAdminiNumi++ )
    {
        if( 
is_user_admin( ( iAdmin iPlayer] ) ) )
        {
            
set_hudmessage02550, -1.0, -1.0 )
            
show_hudmessageiAdmin"Player %s has disconnected"szName )
        }
    }



Natsheh 04-03-2022 22:03

Re: Player disconnected - HUD message for Admins only
 
In what particular reason you're using the loop?

You simply don't need to loop the players just check whether the id ( 1st parameter in client_disconnect ) is an admin.

Supremache 04-03-2022 22:48

Re: Player disconnected - HUD message for Admins only
 
Quote:

Originally Posted by Natsheh (Post 2775762)
In what particular reason you're using the loop?

You simply don't need to loop the players just check whether the id ( 1st parameter in client_disconnect ) is an admin.

Quote:

Admins only know via a HUD message when a player disconnects

Natsheh 04-03-2022 23:07

Re: Player disconnected - HUD message for Admins only
 
Alright then add the flags "ch" to exclude bots and HLTV clients to get_players.

Supremache 04-03-2022 23:11

Re: Player disconnected - HUD message for Admins only
 
Quote:

Originally Posted by Natsheh (Post 2775767)
Alright then add the flags "ch" to disclude bots and HLTV clients to get_players

I guess it doesn't matter who gives the admin access to the bot or hltv and if so it's just a message anyway I've added

StDenisGamers 04-11-2022 11:30

Re: Player disconnected - HUD message for Admins only
 
I tried it and sadly it didnt work.

Thanks again.

Supremache 04-12-2022 10:45

Re: Player disconnected - HUD message for Admins only
 
I thought it, It's not possible to create a loop inside 'client disconnected' function, Try this:
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new g_szName32 ];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
set_task1.0"OnTaskDisconnected", .flags "b" )
}

public 
client_disconnectid )
{    
    
get_user_nameidg_szNamecharsmaxg_szName ) );


public 
OnTaskDisconnected( )
{
    if( 
g_szName] != EOS )
    {
        new 
iPlayer32 ], iNum;
        
get_playersiPlayeriNum"ch" )
    
        for( new 
iiAdminiNumi++ )
        {
            if( 
is_user_admin( ( iAdmin iPlayer] ) ) )
            {
                
set_hudmessage02550, -1.0, -1.0 )
                
show_hudmessageiAdmin"Player %s has disconnected"g_szName )
            }
        }
        
g_szName] = EOS
    
}



iceeedr 04-12-2022 13:08

Re: Player disconnected - HUD message for Admins only
 
I don't think you need a fixed task for that.

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new g_szName32 ]

public 
plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_disconnectid )
{
        
get_user_nameidg_szNamecharsmaxg_szName ) )
        
set_task(1.0"OnTaskDisconnected")
}

public 
OnTaskDisconnected()
{
        new 
iPlayer32 ], iNum;
        
get_playersiPlayeriNum"ch" )

        for( new 
iiAdminiNumi++ )
        {
                if( 
is_user_admin( ( iAdmin iPlayer] ) ) )
                {
                        
set_hudmessage02550, -1.0, -1.0 )
                        
show_hudmessageiAdmin"Player %s has disconnected"g_szName )
                }
        }

        
g_szName[0] = EOS



StDenisGamers 04-12-2022 21:12

Re: Player disconnected - HUD message for Admins only
 
1 Attachment(s)
Quote:

Originally Posted by Supremache (Post 2776589)
I thought it, It's not possible to create a loop inside 'client disconnected' function, Try this:
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new g_szName32 ];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
set_task1.0"OnTaskDisconnected", .flags "b" )
}

public 
client_disconnectid )
{    
    
get_user_nameidg_szNamecharsmaxg_szName ) );


public 
OnTaskDisconnected( )
{
    if( 
g_szName] != EOS )
    {
        new 
iPlayer32 ], iNum;
        
get_playersiPlayeriNum"ch" )
    
        for( new 
iiAdminiNumi++ )
        {
            if( 
is_user_admin( ( iAdmin iPlayer] ) ) )
            {
                
set_hudmessage02550, -1.0, -1.0 )
                
show_hudmessageiAdmin"Player %s has disconnected"g_szName )
            }
        }
    }




it works!

the HUD message is in the middle and in a green to quickly spot.

:)


Approve this plugin!!!! :up:


--many thanks to Supremache and Koz for the assistance!


All times are GMT -4. The time now is 10:33.

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