Something like this:
PHP Code:
#include <amxmodx>
#define VERSION "1.0"
new bool:g_bAlive[ 33 ];
public plugin_init()
{
register_plugin( "Spectator Was Alive?", VERSION, "Dores" );
register_event( "DeathMsg", "ev_Death", "a" );
register_event( "ResetHUD", "ev_NotOnlyRespawnButThatsWhatINeed", "b" );
register_event( "TeamInfo", "ev_TeamInfo", "a" );
}
public ev_Death()
{
g_bAlive[ read_data( 2 ) ] = false;
}
public ev_NotOnlyRespawnButThatsWhatINeed( id )
{
g_bAlive = bool:( is_user_alive( id ) );
}
public ev_TeamInfo()
{
static id ; id = read_data( 1 );
static team[ 15 ] ; read_data( 2, team, charsmax( team ) );
if( team[ 0 ] == 'S' && g_bAlive[ id ] )
{
g_bAlive[ id ] = false;
client_print( 0, print_chat, "LoL Moved to Spectator team while being alive!" );
}
}
Or instead of hooking ResetHUD use this:
PHP Code:
#include <fakemeta>
public plugin_init()
{
register_forward( FM_Spawn, "Forward_Spawn", 1 );
}
// [...]
public Forward_Spawn( ent )
{
static szClass[ 32 ] ; pev( ent, pev_classname, szClass, charsmax( szClass ) );
if( !equal( szClass, "player" ) )
{
return;
}
g_bAlive[ ent ] = bool:( is_user_alive( ent ) );
}
// Or this:
#include <hamsandwich>
public plugin_init()
{
RegisterHam( Ham_Spawn, "player", "Forward_PlayerSpawn", 1 );
}
public Forward_PlayerSpawn( id )
{
g_bAlive[ id ] = bool:( is_user_alive( id ) );
}
__________________