Problem with /invis

Started by Alucard^
06/05/2008 03:10
Page 1 of 1
Alucard^06/05/2008 03:10(edited 06/05/2008 03:10)

hi guys... here a problem with this plugin of SchlumPF* (modificated by stask0)

[blockquote]

#include 
#include
#include
#include

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

public plugin_init( )
{
register_plugin( "Invisible", "1.2", "SchlumPF* & stask0" );
set_task( 150.0, "invishelp", _, _, _, "b" )

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

register_forward(FM_AddToFullPack, "addToFullPack", 1)

register_menucmd( register_menuid( "\rInvisibility Menu^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] )
fm_set_rendering( ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0)
else if( !g_bPlayerInvisible[host] )
fm_set_rendering( ent, kRenderFxNone, 255, 255, 255, kRenderNormal, 25 )
}

if( pev_valid( ent ) )
{
//maybe need some new code so it does use less cpu even if this should not be an expensive cpu
static classname[32]
pev( ent, pev_classname, classname, sizeof classname - 1 )

if( equali( classname, "func_water" ) )
{
if( g_bWaterInvisible[host] )
fm_set_entity_visibility( ent, 0 )
else if( !g_bWaterInvisible[host] )
fm_set_entity_visibility( ent, 1 )
}
}

return PLUGIN_HANDLED;
}

public menuInvisDisplay( plr )
{
static menu[2048];
new keys = ( 1<<0 | 1<<1 | 1<<2 | 1<<9 );

new player[3], water[3], both[3];
format( player, sizeof player - 1, "%s", g_bPlayerInvisible[plr] ? "\d" : "\w" );
format( water, sizeof water - 1, "%s", g_bWaterInvisible[plr] ? "\d" : "\w" );
format( both, sizeof both - 1, "%s" , g_bBothInvisible[plr] ? "\d" : "\w" );

new len = format( menu, sizeof menu - 1, "\rInvisibility Menu^n^n" );

len += format( menu[len], sizeof menu - len, "\r01. %sPlayers: \y%s^n", player, g_bPlayerInvisible[plr] ? "Invisible" : "Visible" )
len += format( menu[len], sizeof menu - len, "\r02. %sWater: \y%s^n^n", water, g_bWaterInvisible[plr] ? "Invisible": "Visible" )
len += format( menu[len], sizeof menu - len, "\r03. %sPlayers & Water: \y%s^n^n", both, g_bBothInvisible[plr] ? "Invisible" : "Visible" );
len += format( menu[len], sizeof menu - len, "\r00. \wExit" );

show_menu( plr, keys, menu, -1 );

return PLUGIN_HANDLED;
}

public menuInvisAction( plr, key )
{
switch( key )
{
case 0:
{
g_bPlayerInvisible[plr] = g_bPlayerInvisible[plr] ? false : true;
ColorChat( plr, GREEN, "[KZ] All the players are now %s for you.", g_bPlayerInvisible[plr] ? "invisible" : "visible" );

menuInvisDisplay( plr );
}
case 1:
{
g_bWaterInvisible[plr] = g_bWaterInvisible[plr] ? false : true;
ColorChat( plr, GREEN, "[KZ] The water is now %s for you.", g_bWaterInvisible[plr] ? "invisible" : "visible" );

menuInvisDisplay( plr );
}
case 2:
{
g_bBothInvisible[plr] = g_bBothInvisible[plr] ? false : true;
ColorChat( plr, GREEN, "[KZ] The players & water are now %s for you.", g_bBothInvisible[plr] ? "invisible" : "visible" );

menuInvisDisplay( plr );
}
case 9: show_menu( plr, 0, "" );
}

return PLUGIN_HANDLED;
}

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

public invishelp()
{
ColorChat(0, GREEN, "[KZ] In order to make your fps higher, type /invis.");
}
[/blockquote]

the menu work, but dont invis nothing...

thx

SchlumPF06/05/2008 03:32

use this, fixed some things and made it more fps friendly
http://todome.de/schlumpf/plugins/invis.rar

Alucard^07/05/2008 05:12

thx SchlumPF* work fine

Page 1 of 1

Please log in to post replies.