 |
|
Junior Member
Join Date: Dec 2021
Location: USA
|

04-12-2022
, 21:12
Re: Player disconnected - HUD message for Admins only
|
#9
|
Quote:
Originally Posted by Supremache
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_szName[ 32 ];
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) set_task( 1.0, "OnTaskDisconnected", .flags = "b" ) }
public client_disconnect( id ) { get_user_name( id, g_szName, charsmax( g_szName ) ); }
public OnTaskDisconnected( ) { if( g_szName[ 0 ] != EOS ) { new iPlayer[ 32 ], iNum; get_players( iPlayer, iNum, "ch" ) for( new i, iAdmin; i < iNum; i++ ) { if( is_user_admin( ( iAdmin = iPlayer[ i ] ) ) ) { set_hudmessage( 0, 255, 0, -1.0, -1.0 ) show_hudmessage( iAdmin, "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!!!!
--many thanks to Supremache and Koz for the assistance!
__________________
Last edited by StDenisGamers; 04-12-2022 at 21:13.
|
|
|
|