AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invisiblity by SchlumPF* (https://forums.alliedmods.net/showthread.php?t=133836)

FiFiX 07-29-2010 07:13

Invisiblity by SchlumPF*
 
Code:

#include <amxmodx>
#include <fakemeta>

#pragma semicolon 1

new bool:g_bPlayerInvisible[33], bool:g_bWaterInvisible[33];

public plugin_init( )
{
    register_plugin( "Invisible", "1.3", "SchlumPF*" );

    register_clcmd( "say /invis", "menuInvisDisplay" );

    register_forward( FM_AddToFullPack, "fwdAddToFullPack", 1 );

    register_menucmd( register_menuid( "\rInvisibility - SchlumPF^n^n" ), 1023, "menuInvisAction" );
}

public fwdAddToFullPack( es_handle, e, ent, host, hostflags, player, pset )
{
    if( is_user_alive( ent ) && is_user_alive( host ) )
        if( g_bPlayerInvisible[host] )
            set_es( es_handle, ES_Effects, EF_NODRAW );
   
    if( pev_valid( ent ) )
    {
        static classname[32];
        pev( ent, pev_classname, classname, sizeof classname - 1 );

        // need to remove the string comapring here to save much cpu
        if( equali( classname, "func_water" ) )
            if( g_bWaterInvisible[host] )
                set_es( es_handle, ES_Effects, EF_NODRAW );
    }
   
    return PLUGIN_HANDLED;
}

public menuInvisDisplay( plr )
{
    static menu[2048];
    new keys = ( 1<<0 | 1<<1 | 1<<9 );
   
    new player[3], water[3];
    format( player, sizeof player - 1, "%s", g_bPlayerInvisible[plr] ? "\d" : "\w" );
    format( water, sizeof water - 1, "%s", g_bWaterInvisible[plr] ? "\d" : "\w" );
   
    new len = format( menu, sizeof menu - 1, "\rInvisibility - SchlumPF^n^n" );
   
    len += format( menu[len], sizeof menu - len, "\r01. %sPlayers^n", player );
    len += format( menu[len], sizeof menu - len, "\r02. %sWater^n^n", water );
    len += format( menu[len], sizeof menu - len, "\r00. \wExit" );
   
    show_menu( plr, keys, menu, -1 );
   
    return PLUGIN_HANDLED;
}

public menuInvisAction( plr, key )
{
    static message[192];
   
    switch( key )
    {
        case 0:
        {
            g_bPlayerInvisible[plr] = g_bPlayerInvisible[plr] ? false : true;
           
            message[0] = 0x04;
           
            format( message[1], sizeof message - 2, "[XJ] ^x01All players are now %s.", g_bPlayerInvisible[plr] ? "visible" : "invisible" );
           
            menuInvisDisplay( plr );
        }
        case 1:
        {
            g_bWaterInvisible[plr] = g_bWaterInvisible[plr] ? false : true;
           
            message[0] = 0x04;
            format( message[1], sizeof message - 2, "[XJ] ^x01Water is now %s.", g_bWaterInvisible[plr] ? "visible" : "invisible" );
           
            menuInvisDisplay( plr );
        }
        case 9: show_menu( plr, 0, "" );
    }
   
    return PLUGIN_HANDLED;
}

public client_connect( plr )
{
    g_bPlayerInvisible[plr] = false;
    g_bWaterInvisible[plr] = false;
}

Is it possible to make that Terro will see CT and CT wil see Terro? But CT still wouldn't see another CT?

FiFiX 08-05-2010 07:47

Re: Invisiblity by SchlumPF*
 
Bump. ANyone?

xPaw 08-05-2010 07:59

Re: Invisiblity by SchlumPF*
 
Quote:

Originally Posted by FiFiX (Post 1254999)
Is it possible to make that Terro will see CT and CT wil see Terro? But CT still wouldn't see another CT?

Yes, possible.

mottzi 08-05-2010 08:01

Re: Invisiblity by SchlumPF*
 
xPaw can you tell us how, please?

FiFiX 08-05-2010 08:23

Re: Invisiblity by SchlumPF*
 
In public fdwAddToFullPack check the 'host^'s' team, and if it is TT make return PLUGIN_HANDLED?

karceWZROKIEM 08-05-2010 12:06

Re: Invisiblity by SchlumPF*
 
public fwdAddToFullPack( es_handle, e, ent, host, hostflags, player, pset )
{
if( is_user_alive( ent ) && is_user_alive( host ) )
if( YOUR_COMPLEX_CONDITION )
set_es( es_handle, ES_Effects, EF_NODRAW );

return PLUGIN_HANDLED;
}


All times are GMT -4. The time now is 00:17.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.