Код за потвърждение: Избери целия код
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
#pragma semicolon 1
new bool:g_bPlayerInvisible[33], bool:g_bWaterInvisible[33];
new bool:g_bWaterEntity[1386], bool:g_bWaterFound;
new g_iSpectatedId[33];
public plugin_init( )
{
register_plugin( "Invis", "1.4", "SchlumPF");
register_clcmd( "say /invis", "menuInvisDisplay" );
register_menucmd( register_menuid( "\rInvisibility - SchlumPF^n^n" ), 1023, "menuInvisAction" );
register_forward( FM_PlayerPreThink, "fwdPlayerPreThink_Pre", 0 );
register_forward( FM_AddToFullPack, "fwdAddToFullPack_Post", 1 );
RegisterHam( Ham_Spawn, "player", "hamSpawnPlayer_Post", 1 );
}
public plugin_cfg( )
{
// find all water entitys to make AddToFullPack use less cpu
new ent = engfunc( EngFunc_FindEntityByString, -1, "classname", "func_water" );
while( ent )
{
if( !g_bWaterFound )
{
g_bWaterFound = true;
}
g_bWaterEntity[ent] = true;
ent = engfunc( EngFunc_FindEntityByString, ent, "classname", "func_water" );
}
}
public fwdPlayerPreThink_Pre( plr )
{
if( !is_user_alive( plr ) )
{
g_iSpectatedId[plr] = pev( plr, pev_iuser2 );
}
}
public fwdAddToFullPack_Post( es_handle, e, ent, host, hostflags, player, pset )
{
if( player )
{
if( g_bPlayerInvisible[host] && host != ent )
{
if( ent != g_iSpectatedId[host] && cs_get_user_team( host ) == cs_get_user_team( ent ) )
{
set_es( es_handle, ES_Origin, { 999999999.0, 999999999.0, 999999999.0 } );
set_es( es_handle, ES_RenderMode, kRenderTransAlpha );
set_es( es_handle, ES_RenderAmt, 0 );
}
}
}
else if( g_bWaterInvisible[host] )
{
if( g_bWaterEntity[ent] )
{
set_es( es_handle, ES_Effects, EF_NODRAW );
}
}
}
public hamSpawnPlayer_Post( plr )
{
g_iSpectatedId[plr] = 0;
}
public menuInvisDisplay( plr )
{
static menu[2048];
new len = format( menu, sizeof menu - 1, "\rInvisibility - SchlumPF^n^n" );
len += format( menu[len], sizeof menu - len, "\r01. Players: %s^n", g_bPlayerInvisible[plr] ? "invisible" : "visible" );
len += format( menu[len], sizeof menu - len, "\r02. Water: %s^n^n", g_bWaterFound ? ( g_bWaterInvisible[plr] ? "invisible" : "visible" ) : "there is no water" );
len += format( menu[len], sizeof menu - len, "\r00. \wExit" );
show_menu( plr, ( 1<<0 | 1<<1 | 1<<9 ), menu, -1 );
return PLUGIN_HANDLED;
}
public menuInvisAction( plr, key )
{
switch( key )
{
case 0:
{
g_bPlayerInvisible[plr] = !g_bPlayerInvisible[plr];
menuInvisDisplay( plr );
}
case 1:
{
g_bWaterInvisible[plr] = !g_bWaterInvisible[plr];
menuInvisDisplay( plr );
}
case 9: show_menu( plr, 0, "" );
}
}
public client_connect( plr )
{
g_bPlayerInvisible[plr] = false;
g_bWaterInvisible[plr] = false;
g_iSpectatedId[plr] = 0;
}