[Req] Old style to new style menu
Hi, I want to make this plugin with new style menu:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>
new bool:g_bPlayerInvisible[ 33 ]
new g_iSpectatedId[ 33 ]
public plugin_init()
{
register_plugin( "Invis", "1.4", "SchlumPF" )
register_clcmd( "say /invis", "menuInvisDisplay" )
&nb sp; register_clcmd( "say_team /invis", "menuInvisDisplay" )
register_clcmd( "say /fps", "menuInvisDisplay" )
register_clcmd( "say_team /fps", "menuInvisDisplay" )
register_menucmd( register_menuid( "\r[Darknezz-zone] \wMore FPS^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 client_connect( id )
{
g_bPlayerInvisible[ id ] = false
g_iSpectatedId[ id ] = 0
}
public fwdPlayerPreThink_Pre( id )
{
if( !is_user_alive( id ) )
{
g_iSpectatedId[ id ] = pev( id, pev_iuser2 )
}
}
public hamSpawnPlayer_Post( id&n bsp;)
{
g_iSpectatedId[ id ] = 0
}
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 )
}
}
}
}
public menuInvisDisplay( id )
{&n bsp;
static menu[ 2048 ]
if( is_user_alive( id ) && get_user_team( id ) == 1 )
{
new len = format( menu, sizeof menu - 1, "\r[Darknezz-zone] \wMore FPS^n^n" )
&n bsp; len += format( menu[ len ], sizeof menu - len, "\r1. \wHide Terrorist \y- %s^n", g_bPlayerInvisible[id] ? "OFF" : "ON" )
len += format (menu[ len ], sizeof menu - len, "\r2. \wExit" )
& nbsp;}
if( is_user_alive( id ) && get_user_team( id ) == 2 )
{
new len = format( menu, sizeof menu - 1, "\r[Darknezz-zone] \wMore FPS^n^n" )
len += format( menu[ len ], sizeof menu - len, "\r1. \wHide Counter-Terrorist \y- %s^n", g_bPlayerInvisible[id] ? "OFF" : "ON" )
len += format( menu[ len ], sizeof menu - len, "\r2. \wExit" )
}
show_menu( id, ( 1<<0 | 1<<1 | 1<<2 ), menu, -1 )
return PLUGIN_HANDLED
}
public menuInvisAction( id, key )
{
switch( key )
{
case 0:
{
g_bPlayerInvisible[ id ] = !g_bPlayerInvisible[ id ]
menuInvisDisplay( id )
}
case 9: show_menu( id, 2, "" )
}
}
Orignal From: [Req] Old style to new style menu
Post a Comment