Код за потвърждение: Избери целия код
#include < amxmodx >
#include < cstrike >
#include < fun >
#include < hamsandwich >
#include < colorchat >
#define VERSION "1.0"
#define PREFIX "[Noclip & Godmode]"
new bool:iNoclip[ 33 ], iGodmode[ 33 ];
new cvar_admin_flag, cvar_glow, cvar_message, cvar_glow_t_color, cvar_glow_ct_color, cvar_noclip, cvar_godmode;
public plugin_init( )
{
register_plugin( "Noclip and Godmode for admin", VERSION, "DukMeN" );
register_clcmd( "say /noclip", "cmdSayCommand" );
register_clcmd( "say /godmode", "cmdSayCommand" );
RegisterHam( Ham_Spawn, "player", "fwdPSpawn", 1 );
cvar_noclip = register_cvar( "ng_noclip_on", "1" );
cvar_godmode = register_cvar( "ng_godmode_on", "1" );
cvar_admin_flag = register_cvar( "ng_admin_flag", "d" );
cvar_message = register_cvar( "ng_show_message", "1" );
cvar_glow = register_cvar( "ng_glow", "1" );
cvar_glow_t_color = register_cvar( "ng_glow_t_color", "255 0 0" );
cvar_glow_ct_color = register_cvar( "ng_glow_ct_color", "0 0 255" );
}
public fwdPSpawn( id )
{
if( is_user_alive( id ) )
{
set_user_noclip( id, 0 );
set_user_godmode( id, 0 );
iNoclip[ id ] = false;
iGodmode[ id ] = false;
show_menu( id, 0, "^n", 1 );
if( get_pcvar_num( cvar_glow ) ) set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16 );
}
}
public cmdSayCommand( id )
{
new flag[ 33 ];
get_pcvar_string( cvar_admin_flag, flag, charsmax( flag ) );
if( !( get_user_flags( id ) & read_flags( flag ) ) )
{
ColorChat( id, GREEN, "%s^1 You have not^3 access^4 to that^1 command.", PREFIX );
return PLUGIN_CONTINUE;
}
if( !is_user_alive( id ) )
{
ColorChat( id, GREEN, "%s^1 You must be^3 alive to use^4 this^1 command.", PREFIX );
return PLUGIN_CONTINUE;
}
ShowMenu( id );
return PLUGIN_CONTINUE;
}
ShowMenu( id )
{
new menu = menu_create( "\yNoclip \r& \yGodmode \wMenu", "menuHandler" );
if( get_pcvar_num( cvar_noclip ) ) iNoclip[ id ] ? menu_additem( menu, "\yNoclip \r[\wON\r]", "1", 0 ) : menu_additem( menu, "\yNoclip \r[\dOFF\r]", "1", 0 );
if( get_pcvar_num( cvar_godmode ) ) iGodmode[ id ] ? menu_additem( menu, "\yGodmode \r[\wON\r]", "2", 0 ) : menu_additem( menu, "\yGodmode \r[\dOFF\r]", "2", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
}
public menuHandler( id, menu, item )
{
if( item == MENU_EXIT || !is_user_alive( id ) )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
new iData[ 6 ], iName[ 64 ], iAccess, iCallback;
menu_item_getinfo( menu, item, iAccess, iData, charsmax( iData ), iName, charsmax( iName ), iCallback );
switch( str_to_num( iData ) )
{
case 1:
{
iNoclip[ id ] = !iNoclip[ id ];
set_user_noclip( id, iNoclip[ id ] ? 1 : 0 );
if( get_pcvar_num( cvar_message ) ) ColorChat( id, GREEN, "%s^1 Noclip^3:^4 %s", PREFIX, iNoclip[ id ] ? "ON" : "OFF" );
ShowMenu( id );
}
case 2:
{
iGodmode[ id ] = !iGodmode[ id ];
set_user_godmode( id, iGodmode[ id ] ? 1 : 0 );
if( get_pcvar_num( cvar_message ) ) ColorChat( id, GREEN, "%s^1 Godmode^3:^4 %s", PREFIX, iGodmode[ id ] ? "ON" : "OFF" );
if( get_pcvar_num( cvar_glow ) )
{
if( iGodmode[ id ] )
{
new tr[ 4 ], tg[ 4 ], tb[ 4 ], ctr[ 4 ], ctg[ 4 ], ctb[ 4 ], iRed, iGreen, iBlue, iColorT[ 33 ], iColorCT[ 33 ];
get_pcvar_string( cvar_glow_t_color, iColorT, charsmax( iColorT ) );
get_pcvar_string( cvar_glow_ct_color, iColorCT, charsmax( iColorCT ) );
parse( iColorT, tr, charsmax( tr ), tg, charsmax( tg ), tb, charsmax( tb ) );
parse( iColorCT, ctr, charsmax( ctr ), ctg, charsmax( ctg ), ctb, charsmax( ctb ) );
if( cs_get_user_team( id ) == CS_TEAM_T )
{
iRed = str_to_num( tr );
iGreen = str_to_num( tg );
iBlue = str_to_num( tb );
set_user_rendering( id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 16 );
}
else if( cs_get_user_team( id ) == CS_TEAM_CT )
{
iRed = str_to_num( ctr );
iGreen = str_to_num( ctg );
iBlue = str_to_num( ctb );
set_user_rendering( id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 16 );
}
}
else set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 16 );
}
ShowMenu( id );
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}