Can somebody add me CVAR for the invisible time and a hud timer that countdowns the seconds according to the CVAR?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_bInvis
#define SetInvis(%1) g_bInvis |= ( 1<<( %1&31 ) )
#define GetInvis(%1) ( g_bInvis & ( 1<<( %1&31 ) ) )
#define RemoveInvis(%1) g_bInvis &= ~( 1<<( %1&31 ) )
public plugin_init()
{
register_plugin( "Invisible on Spawn", "0.0.1", "Exolent" )
register_forward( FM_AddToFullPack, "FwdAddToFullPackPost", 1 )
RegisterHam( Ham_Spawn, "player", "FwdPlayerSpawnPost", 1 )
RegisterHam( Ham_Killed, "player", "FwdPlayerKilledPost", 1 )
}
public client_disconnect( iPlayer )
{
remove_task( iPlayer )
RemoveInvis( iPlayer )
}
public FwdAddToFullPackPost( esHandle, e, iEntity, iHost, iHostFlags, iPlayer, pSet )
{
if( iPlayer )
{
if( iHost != iEntity
&& get_orig_retval( )
&& is_user_alive( iHost )
&& is_user_alive( iEntity )
&& GetInvis( iEntity ) )
{
set_es( esHandle, ES_Origin, Float:{ 9999999.0, 999999.0, 999999.0 } )
set_es( esHandle, ES_Effects, ( get_es( esHandle, ES_Effects ) | EF_NODRAW ) )
}
}
}
public FwdPlayerSpawnPost( iPlayer )
{
if( is_user_alive( iPlayer ) )
{
SetInvis( iPlayer )
remove_task( iPlayer )
set_task( 10.0, "TaskRemoveInvis", iPlayer )
}
}
public FwdPlayerKilledPost( iPlayer )
{
remove_task( iPlayer )
RemoveInvis( iPlayer )
}
public TaskRemoveInvis( iPlayer )
{
RemoveInvis( iPlayer )
}