View Single Post
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-02-2010 , 17:43   Re: Plugin /invis to hide only teammates
Reply With Quote #2

PHP Code:
#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_menucmdregister_menuid"\rInvisibility - SchlumPF^n^n" ), 1023"menuInvisAction" );
    
    
register_forwardFM_PlayerPreThink"fwdPlayerPreThink_Pre");
    
register_forwardFM_AddToFullPack"fwdAddToFullPack_Post");
    
    
RegisterHamHam_Spawn"player""hamSpawnPlayer_Post");
}

public 
plugin_cfg( )
{
    
// find all water entitys to make AddToFullPack use less cpu
    
new ent engfuncEngFunc_FindEntityByString, -1"classname""func_water" );
    while( 
ent )
    {
        if( !
g_bWaterFound )
        {
            
g_bWaterFound true;
        }

        
g_bWaterEntity[ent] = true;
        
        
ent engfuncEngFunc_FindEntityByStringent"classname""func_water" );
    }
}

public 
fwdPlayerPreThink_Preplr )
{
    if( !
is_user_aliveplr ) )
    {
        
g_iSpectatedId[plr] = pevplrpev_iuser2 );
    }
}

public 
fwdAddToFullPack_Postes_handleeenthosthostflagsplayerpset )
{
    if( 
player )
    {
        if( 
g_bPlayerInvisible[host] && host != ent )
        {
            if( 
ent != g_iSpectatedId[host] && cs_get_user_teamhost ) == cs_get_user_teament ) )
            {
                
set_eses_handleES_Origin, { 999999999.0999999999.0999999999.0 } );
                
set_eses_handleES_RenderModekRenderTransAlpha );
                
set_eses_handleES_RenderAmt);
            }
        }
    }
    else if( 
g_bWaterInvisible[host] )
    {
        if( 
g_bWaterEntity[ent] )
        {
            
set_eses_handleES_EffectsEF_NODRAW );
        }
    }
}

public 
hamSpawnPlayer_Postplr )
{
    
g_iSpectatedId[plr] = 0;
}

public 
menuInvisDisplayplr )
{
    static 
menu[2048];

    new 
len formatmenusizeof menu 1"\rInvisibility - SchlumPF^n^n" );
    
    
len += formatmenu[len], sizeof menu len"\r01. Players: %s^n"g_bPlayerInvisible[plr] ? "invisible" "visible" );
    
len += formatmenu[len], sizeof menu len"\r02. Water: %s^n^n"g_bWaterFound ? ( g_bWaterInvisible[plr] ? "invisible" "visible" ) : "there is no water" );
 
    
len += formatmenu[len], sizeof menu len"\r00. \wExit" );
    
    
show_menuplr, ( 1<<1<<1<<), menu, -);
        
    return 
PLUGIN_HANDLED;
}

public 
menuInvisActionplrkey )
{
    switch( 
key )
    {
        case 
0:
        {
            
g_bPlayerInvisible[plr] = !g_bPlayerInvisible[plr];
            
menuInvisDisplayplr );
        }
        case 
1:
        {
            
g_bWaterInvisible[plr] = !g_bWaterInvisible[plr];
            
menuInvisDisplayplr );
        }
        case 
9show_menuplr0"" );
    }
}

public 
client_connectplr )
{
    
g_bPlayerInvisible[plr] = false;
    
g_bWaterInvisible[plr] = false;
    
g_iSpectatedId[plr] = 0;

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 11-02-2010 at 18:07.
Exolent[jNr] is offline