Code:
#include < amxmodx >
#include < hamsandwich >
#pragma semicolon 1
const HudTaskId = 456054;
new gPlayerAlive, g_MsgSync;
public plugin_init( )
{
new const szPluginName[ ] = "Simple Permanent Hud";
new const szVersion[ ] = "0.01";
new const szAuthor[ ] = "Luqqas" ;
register_plugin(
szPluginName,
szVersion,
szAuthor
);
RegisterHam( Ham_Spawn, "player", "fwPlayerSpawn" );
g_MsgSync = CreateHudSyncObj( );
register_event( "DeathMsg", "EvDeathMsg", "a",
"4!trigger_hurt", "4!worldspawn" );
}
public EvDeathMsg( )
gPlayerAlive &= ~( 1 << ( read_data( 2 ) % 32 ) );
public client_disconnect( id )
{
gPlayerAlive &= ~( 1 << ( id % 32 ) );
remove_task( id + HudTaskId );
}
public client_putinserver( id )
{
gPlayerAlive &= ~( 1 << ( id % 32 ) );
set_task( 0.7, "ShowHudPerm", id + HudTaskId, _, _, "b" );
}
public fwPlayerSpawn( id )
{
if( is_user_alive( id ) )
gPlayerAlive |= ( 1 << ( id % 32 ) );
}
public ShowHudPerm( TaskID )
{
static PlayerID;
PlayerID = ( TaskID - HudTaskId );
if( gPlayerAlive & ( 1 << ( PlayerID % 32 ) ) )
return;
static PlayersCount[ 2 ];
PlayersCount[ 0 ] = GetPlayersCount( "TERRORIST" );
PlayersCount[ 1 ] = GetPlayersCount( "CT" );
set_hudmessage( 255, 255 , 255 , 0.35, 0.33, 0, 6.0, 1.1, 0.0, 0.0, -1);
ShowSyncHudMsg(PlayerID, g_MsgSync, ".::Terroristas Vivos [%d] || CT's Vivos [%d]::.", PlayersCount[ 0 ], PlayersCount[ 1 ]);
return;
}
GetPlayersCount( const szTeam[ ] = "" )
{
new iPlayers[ 32 ], iNumber;
get_players( iPlayers, iNumber, "ae", szTeam );
return iNumber;
}