PDA

View Full Version : amxx short commands from chat


Giass
12-10-2016, 08:14
hello!

i got this mod:

#include < amxmodx >
#include < fakemeta >

#pragma semicolon 1

#define MAX_COLORS 11

#define TASKID_RESTART 1000

// Drug ...

#define XO_PLAYER 5
#define m_iFOV 363

enum _:Teams
{
FM_TEAM_UNASSIGNED,
FM_TEAM_T,
FM_TEAM_CT,
FM_TEAM_SPECTATOR
};

enum _:Weapons
{
WEAPON_USP,
WEAPON_GLOCK18,
WEAPON_DEAGLE,
WEAPON_P228,
WEAPON_ELITE,
WEAPON_FIVESEVEN,
WEAPON_M3,
WEAPON_XM1014,
WEAPON_TMP,
WEAPON_MAC10,
WEAPON_MP5NAVY,
WEAPON_P90,
WEAPON_UMP45,
WEAPON_FAMAS,
WEAPON_GALIL,
WEAPON_AK47,
WEAPON_M4A1,
WEAPON_SG552,
WEAPON_AUG,
WEAPON_SCOUT,
WEAPON_SG550,
WEAPON_AWP,
WEAPON_G3SG1,
WEAPON_M249,
WEAPON_HEGRENADE,
WEAPON_SMOKEGRENADE,
WEAPON_FLASHBANG,
WEAPON_SHIELD,
WEAPON_C4,
WEAPON_KNIFE,
ITEM_KEVLAR,
ITEM_ASSAULTSUIT,
ITEM_THIGHPACK
}

enum _:Commands
{
RESTART_ROUND,
T_TRANSFER,
CT_TRANSFER,
SPEC_TRANSFER,
TEAM_TRANSFER,
ROUND_TIME,
FREEZE_TIME,
REVIVE,
AIR_ACCELERATE,
BURY,
UNBURY,
GRAVITY,
PASSWORD,
NO_PASSWORD,
SLAY,
SLAP,
GLOW,
FRIENDLY_FIRE,
NOCLIP,
GODMODE,
HEAL,
WEAPON,
ALLTALK,
BUY_TIME,
MONEY,
KICK,
BAN,
AMXX_MENU,
MAP_MENU,
KICK_MENU,
BAN_MENU,
SLAP_MENU,
TEAM_MENU,
MAP_CHANGE,
MULTI_CVAR,
START_MONEY,
PAUSE,
RESTART,
TELEPORT,
VOTEMAP,
SPEED,
UBERSLAP,
DRUG,
FLASH,
ROCKET,
FIRE
};

new const CommandsName[ Commands ] [ ] =
{
"Round Restart",
"Terrorist Transfer",
"Counter Terrorist Transfer",
"Spectator Transfer",
"Team Transfer",
"Round Time",
"Freeze Time",
"Revive",
"Air Accelerate",
"Bury",
"Un Bury",
"Gravity",
"Password",
"No Password",
"Slay",
"Slap",
"Glow",
"Friendly Fire",
"Noclip",
"Godmode",
"Heal",
"Weapon",
"Alltalk",
"Buy Time",
"Money",
"Kick",
"Ban",
"AMXX Menu",
"Map Menu",
"Kick Menu",
"Ban Menu",
"Slap Menu",
"Team Menu",
"Map Change",
"Multi Cvar",
"Start Money",
"Pause",
"Restart Server",
"Teleport",
"Votemap",
"Speed",
"Uberslap",
"Drug",
"Flash",
"Rocket",
"Fire"
};

new const CommandsInChat[ Commands ] [ ] =
{
"rr",
"t",
"ct",
"spec",
"team",
"rt",
"ft",
"revive",
"aa",
"bury",
"unbury",
"gravity",
"pass",
"nopass",
"slay",
"slap",
"glow",
"ff",
"noclip",
"godmode",
"heal",
"weapon",
"alltalk",
"buytime",
"money",
"kick",
"ban",
"amxx",
"mmenu",
"kmenu",
"bmenu",
"smenu",
"tmenu",
"map",
"cvar",
"startmoney",
"pause",
"restart",
"teleport",
"votemap",
"speed",
"uberslap",
"drug",
"flash",
"rocket",
"fire"
};

new const CommandsLevel[ Commands ] =
{
ADMIN_CVAR,
ADMIN_LEVEL_D,
ADMIN_LEVEL_D,
ADMIN_LEVEL_D,
ADMIN_LEVEL_D,
ADMIN_CVAR,
ADMIN_CVAR,
ADMIN_LEVEL_C,
ADMIN_CVAR,
ADMIN_LEVEL_B,
ADMIN_LEVEL_B,
ADMIN_CVAR,
ADMIN_PASSWORD,
ADMIN_PASSWORD,
ADMIN_SLAY,
ADMIN_LEVEL_B,
ADMIN_LEVEL_D,
ADMIN_CVAR,
ADMIN_LEVEL_C,
ADMIN_LEVEL_C,
ADMIN_LEVEL_A,
ADMIN_LEVEL_C,
ADMIN_CVAR,
ADMIN_CVAR,
ADMIN_LEVEL_C,
ADMIN_KICK,
ADMIN_BAN,
ADMIN_MENU,
ADMIN_MENU,
ADMIN_MENU,
ADMIN_MENU,
ADMIN_MENU,
ADMIN_MENU,
ADMIN_MAP,
ADMIN_CVAR,
ADMIN_CVAR,
ADMIN_CVAR,
ADMIN_BAN,
ADMIN_LEVEL_A,
ADMIN_VOTE,
ADMIN_LEVEL_C,
ADMIN_LEVEL_B,
ADMIN_LEVEL_C,
ADMIN_LEVEL_B,
ADMIN_LEVEL_B,
ADMIN_LEVEL_B
};

new const GlowColorNames[ MAX_COLORS ] [ ] =
{
"Blue",
"Green",
"Red",
"White",
"Yellow",
"Aqua",
"Purple",
"Pink",
"Silver",
"Gold",
"Off"
};

new const GlowInChat[ MAX_COLORS ] [ ] =
{
"blue",
"green",
"red",
"white",
"yellow",
"aqua",
"purple",
"pink",
"silver",
"gold",
"off"
};

new const GlowColors[ MAX_COLORS ] [ 3 ] =
{
{ 0, 0, 255 },
{ 0, 255, 0 },
{ 255, 0, 0 },
{ 255, 255, 255 },
{ 255, 255, 0 },
{ 0, 150, 255 },
{ 255, 0, 255 },
{ 255, 190, 190 },
{ 192, 192, 192 },
{ 220, 220, 0 },
{ 0, 0, 0 }
};

new const weapons[ Weapons ][ ] = {
"weapon_usp",
"weapon_glock18",
"weapon_deagle",
"weapon_p228",
"weapon_elite",
"weapon_fiveseven",
"weapon_m3",
"weapon_xm1014",
"weapon_tmp",
"weapon_mac10",
"weapon_mp5navy",
"weapon_p90",
"weapon_ump45",
"weapon_famas",
"weapon_galil",
"weapon_ak47",
"weapon_m4a1",
"weapon_sg552",
"weapon_aug",
"weapon_scout",
"weapon_sg550",
"weapon_awp",
"weapon_g3sg1",
"weapon_m249",
"weapon_hegrenade",
"weapon_smokegrenade",
"weapon_flashbang",
"weapon_shield",
"weapon_c4",
"weapon_knife",
"item_kevlar",
"item_assaultsuit",
"item_thighpack"
};

new CvarOnOff;
new CvarHelp;
new CvarFireIginite;

new bool:g_freezetime = true;

new g_speed[ 33 ];
new rocket_z[ 33 ];
new bool:onfire[ 33 ];

new msgid_SetFOV;
new msgid_ScreenFade;
new msgid_Damage;

new mflash;
new smoke;
new blueflare2;
new white;

public plugin_precache( )
{
/* Flash */

precache_sound( "weapons/flashbang-2.wav" );

/* Rocket */

precache_sound( "weapons/rocketfire1.wav" );
precache_sound( "weapons/rocket1.wav" );

/* Fire */

precache_sound( "ambience/flameburst1.wav" );
precache_sound( "scientist/scream21.wav" );
precache_sound( "scientist/scream07.wav" );

/* Effects */

mflash = precache_model( "sprites/muzzleflash.spr" );
smoke = precache_model( "sprites/steam1.spr" );
blueflare2 = precache_model( "sprites/blueflare2.spr" );
white = precache_model( "sprites/white.spr" );
}

public plugin_init( )
{
register_plugin( "Amxx Cmd Advanced", "1.4", "ImNativus" );

register_clcmd( "say", "HandleSay" );
register_clcmd( "say_team", "HandleSay" );

register_event( "CurWeapon", "EventCurWeapon", "be", "1=1" );
register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );

register_logevent( "LogEventNewRound", 2, "1=Round_Start" );

msgid_SetFOV = get_user_msgid( "SetFOV" );
msgid_ScreenFade = get_user_msgid( "ScreenFade" );
msgid_Damage = get_user_msgid("Damage");

CvarOnOff = register_cvar( "amxx_cmd", "1" );
CvarHelp = register_cvar( "amxx_help", "1" );
CvarFireIginite = register_cvar( "amxx_fireignite", "0" );

set_task( 300.0, "TaskHelpMessage", _, _, _, "b" );
}

public TaskHelpMessage( )
{
ColorChat( 0, "This Plugin built by^3 ImNativus" );

if ( !get_pcvar_num( CvarHelp ) )
return;

new message[ 192 ];

formatex( message, sizeof( message ) - 1, "^3Need Help ?^1 Type:^4 " );

for ( new i = 0; i < Commands; i += 20 )
{
add( message, sizeof( message ) - 1, "!help" );

if ( i != 0 )
{
new number[ 3 ];
formatex( number, sizeof( number ) - 1, "%d ", i / 20 + 1 );

add( message, sizeof( message ) - 1, number );
}

else
{
add( message, sizeof( message ) - 1, " " );
}
}

ColorChat( 0, "%s", message );
}

public HandleSay( client )
{
new message[ 192 ], arg[ 64 ], cmd[ 64 ];

read_argv( 1, message, sizeof( message ) - 1 );

parse( message, arg, sizeof( arg ) - 1 );

new num = str_to_num( arg[ strlen( arg ) - 1 ] ) < 0 ? 0 : str_to_num( arg[ strlen( arg ) - 1 ] );

if ( get_user_flags( client ) & ADMIN_CVAR )
{
if ( equali( message, "!toggle" ) )
{
set_pcvar_num( CvarOnOff, get_pcvar_num( CvarOnOff ) == 0 ? 1 : 0 );

ColorChat( client, "The plugin is now:^3 %s", get_pcvar_num( CvarOnOff ) == 1 ? "On" : "Off" );

return PLUGIN_HANDLED;
}
}

if ( get_pcvar_num( CvarHelp ) && containi( message, "!help" ) != -1 )
{
ShowMOTD( client, ( ( num * 2 ) * 10 ) - 20 > 0 ? ( ( num * 2 ) * 10 ) - 20 : 0, ( ( num * 2 ) * 10 ) > Commands ? Commands : num * 10 + 20 );
}

else
{
for ( new i = 0; i < Commands; i++ )
{
formatex( cmd, sizeof( cmd ) - 1, "!%s", CommandsInChat[ i ] );

if ( equali( arg, cmd ) )
{
if ( get_pcvar_num( CvarOnOff ) )
{
if ( get_user_flags( client ) & CommandsLevel[ i ] )
{
HandleCommands( client, message, i );

return PLUGIN_HANDLED;
}

else
{
console_print( client, "You have no access to this command." );

client_print( client, print_chat, "You have no access to this command." );
}
}

else
{
ColorChat( client, "The plugin is off. Activate it before using it^3 [ !toggle ]" );
}
}
}
}

return PLUGIN_CONTINUE;
}

public HandleCommands( client, const message[ 192 ], command )
{
new cmd[ 64 ], arg[ 64 ], arg1[ 64 ], arg2[ 64 ], arg3[ 64 ], NameSz[ 32 ], player;

parse( message, cmd, 63, arg, 63, arg1, 63, arg2, 63, arg3, 63 );

get_user_name( client, NameSz, sizeof( NameSz ) );

ColorChat( 0, "Admin^4 %s^1 used^4 %s Command", NameSz, CommandsName[ command ] );

player = command != MULTI_CVAR && command != VOTEMAP ? cmd_target( client, arg, arg1, command ) : 0;

switch( command )
{
case RESTART_ROUND:
{
set_cvar_num( "sv_restart", str_to_num( arg ) > 0 ? str_to_num( arg ) : 1 );
}

case T_TRANSFER:
{
fm_set_user_team( player, FM_TEAM_T );

fm_DispatchSpawn( player );
}

case CT_TRANSFER:
{
fm_set_user_team( player, FM_TEAM_CT );

fm_DispatchSpawn( player );
}

case SPEC_TRANSFER:
{
user_silentkill( player );

fm_set_user_team( player, FM_TEAM_SPECTATOR );
}

case TEAM_TRANSFER:
{
if ( equali( arg1, "t" ) )
{
fm_set_user_team( player, FM_TEAM_T );

fm_set_user_model( player, "guerilla" );
}

else if ( equali( arg1, "ct" ) )
{
fm_set_user_team( player, FM_TEAM_CT );

fm_set_user_model( player, "gign" );
}

else if ( equali( arg1, "spec" ) )
{
fm_set_user_team( player, FM_TEAM_SPECTATOR );

fm_set_user_model( player, "gign" );
}

else
{
ColorChat( client, "^3Error^1: Invalid Team" );
}
}

case ROUND_TIME:
{
if ( str_to_float( arg ) >= 0.0 )
{
set_cvar_float( "mp_roundtime", str_to_float( arg ) );

ColorChat( client, "You changed the^4 Round Time^1 to: %.2f", str_to_float( arg ) );
}
}

case FREEZE_TIME:
{
if ( str_to_float( arg ) >= 0.0 )
{
set_cvar_float( "mp_freezetime", str_to_float( arg ) );

ColorChat( client, "You changed the^4 Freeze Time^1 to: %.2f", str_to_float( arg ) );
}
}

case REVIVE:
{
if ( is_user_alive( player ) )
{
ColorChat( client, "^3Error^1: This action could not perform on^4 live client" );
}

else
{
fm_DispatchSpawn( player );
}
}

case AIR_ACCELERATE:
{
if ( str_to_num( arg ) >= 10 )
{
set_cvar_num( "sv_airaccelerate", str_to_num( arg ) );

ColorChat( client, "You changed the^4 Air Accelerate^1 to: %d", str_to_num( arg ) );
}

else
{
ColorChat( client, "^3Error^1: Wrong Number or Under Limit( 10 )" );
}
}

case BURY, UNBURY:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
new Origin[3], Float:FOrigin[3];
get_user_origin( player, Origin );

Origin[2] = command == BURY ? ( Origin[2] - 35 ) : ( Origin[2] + 35 );

IVecFVec( Origin, FOrigin );

set_pev( player, pev_origin, FOrigin );
}
}

case GRAVITY:
{
if ( str_to_num( arg ) )
{
set_cvar_num( "sv_gravity", str_to_num( arg ) );

ColorChat( client, "You changed the^4 Gravity^1 to: %d", str_to_num( arg ) );
}
}

case PASSWORD:
{
set_cvar_string( "sv_password", arg );

ColorChat( client, "You changed the^4 Password^1 to: %s", arg );
}

case NO_PASSWORD:
{
set_cvar_string( "sv_password", "" );
}

case SLAY:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
user_kill( player );
}
}

case SLAP:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
user_slap( player, 0 );

fm_set_user_health( player, get_user_health( player ) - ( equal( arg1, "" ) ? 0 : str_to_num( arg1 ) ) );
}
}

case GLOW:
{
for ( new i = 0; i < MAX_COLORS; i++ )
{
if ( equal( arg1, GlowInChat[ i ] ) )
{
fm_set_user_rendering( player,
kRenderFxGlowShell,
GlowColors[ i ][ 0 ],
GlowColors[ i ][ 1 ],
GlowColors[ i ][ 2 ],
kRenderNormal,
equal( arg2, "" ) ? 100 : str_to_num( arg2 )
);

ColorChat( player, "Admin^4 %s^1 put^3 %s Glow^1 on you", NameSz, GlowColorNames[ i ] );
}
}
}

case FRIENDLY_FIRE:
{
set_cvar_num( "mp_friendlyfire", str_to_num( arg ) > 0 ? 1 : 0 );

ColorChat( client, "You changed the^4 Friendly Fire^1 to: %d", get_cvar_num( "mp_friendlyfire" ) );
}

case NOCLIP:
{
if ( player )
{
if ( is_user_alive( player ) )
{
fm_set_user_noclip( player, str_to_num( arg1 ) );

ColorChat( player, "Your noclip is now:^3 %s", str_to_num( arg1 ) == 1 ? "On" : "Off" );
}

else
{
ColorChat( client, "^3Error^1: This action could not perform on^4 dead client" );
}
}
}

case GODMODE:
{
if ( player )
{
if ( is_user_alive( player ) )
{
fm_set_user_godmode( player, str_to_num( arg1 ) );

ColorChat( player, "Your godmode is now:^3 %s", str_to_num( arg1 ) == 1 ? "On" : "Off" );
}

else
{
ColorChat( client, "^3Error^1: This action could not perform on^4 dead client" );
}
}
}

case HEAL:
{
new Health = str_to_num( arg1 );

if ( player )
{
if ( Health <= 0 )
{
ColorChat( client, "^3Error^1: Invalid amount of Health" );
}

else
{
fm_set_user_health( player, get_user_health( player ) + str_to_num( arg1 ) );
}
}
}

case WEAPON:
{
new weapon = str_to_num( arg1 );

if ( player )
{
if ( weapon <= 0 )
{
ColorChat( client, "^3Error^1: Invalid Weapon" );
}

else
{
give_weapon( player, weapon );
}
}
}

case ALLTALK:
{
set_cvar_num( "sv_alltalk", str_to_num( arg ) > 0 ? 1 : 0 );

ColorChat( client, "You changed the^4 All Talk^1 to: %d", get_cvar_num( "sv_alltalk" ) );
}

case BUY_TIME:
{
set_cvar_float( "mp_buytime", str_to_float( arg ) > 0.0 ? str_to_float( arg ) : 0.0 );

ColorChat( client, "You changed the^4 Buy Time^1 to: %.2f", get_cvar_float( "mp_buytime" ) );
}

case MONEY:
{
new Money = str_to_num( arg1 );

if ( player )
{
if ( Money <= 0 )
{
ColorChat( client, "^3Error^1: Invalid amount of Money" );
}

else
{
fm_set_user_money( player, Money );
}
}
}

case KICK:
{
client_cmd( client, "amx_kick %s", arg );
}

case BAN:
{
client_cmd( client, "amx_ban %s %s %s", arg, arg1, arg2 );
}

case AMXX_MENU:
{
client_cmd( client, "amxmodmenu" );
}

case MAP_MENU, KICK_MENU, BAN_MENU, SLAP_MENU, TEAM_MENU:
{
new menu[64];

parse( CommandsName[ command ], menu, 63 );

client_cmd( client, "amx_%smenu", menu );
}

case MAP_CHANGE:
{
client_cmd( client, "amx_map %s", arg );
}

case MULTI_CVAR:
{
new multicvar[ 168 ];

for ( new i = strlen( cmd ); i < strlen( message ); i++ )
{
new num = i - strlen( cmd ) - 1 > 0 ? i - strlen( cmd ) - 1 : 0;

multicvar[ num ] = message[ i ];
}

new cvar[ 32 ];

parse( multicvar, cvar, 31 );

if ( cvar_exists( cvar ) )
{
client_cmd( client, "amx_cvar %s", multicvar );
}

else
{
ColorChat( client, "^3Error^1: Invalid Cvar." );
}
}

case START_MONEY:
{
if ( str_to_num( arg ) >= 0 )
{
set_cvar_num( "mp_startmoney", str_to_num( arg ) );

ColorChat( client, "You changed the^4 Start Money^1 to: %d", str_to_num( arg ) );
}
}

case PAUSE:
{
client_cmd( client, "amx_pause" );
}

case RESTART:
{
if ( !task_exists( TASKID_RESTART ) )
set_task( 3.0, "RestartSvr", TASKID_RESTART );
}

case TELEPORT:
{

{
new Float:origin[ 3 ];

origin[ 0 ] = str_to_float( arg1 );
origin[ 1 ] = str_to_float( arg2 );
origin[ 2 ] = str_to_float( arg3 );

set_pev( player, pev_origin, origin );
}
}

case VOTEMAP:
{
client_cmd( client, "amx_votemap %s %s %s %s", arg, arg1, arg2, arg3 );
}

case SPEED:
{
g_speed[ player ] = str_to_num( arg1 ) > 0 ? true : false;

EventCurWeapon( player );
}

case UBERSLAP:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
new ids[ 2 ];
ids[ 0 ] = player;

set_task( 0.1, "TaskSlap", 0, ids, 1, "a", 100 );
}
}

case DRUG:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
if ( is_user_alive( player ) )
{
if ( command == DRUG )
{
ColorChat( player, "%d", pev( player, pev_fov ) );

message_begin( MSG_ONE_UNRELIABLE, msgid_SetFOV, { 0, 0, 0 }, player ) ;
write_byte( 180 );
message_end( );
}
}
}
}

case FLASH:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
if ( is_user_alive( player ) )
{
message_begin( MSG_ONE_UNRELIABLE, msgid_ScreenFade, { 0, 0, 0 }, player ) ;
write_short( 1<<15 );
write_short( 1<<10 );
write_short( 1<<12 );
write_byte( 255 );
write_byte( 255 );
write_byte( 255 );
write_byte( 255 );
message_end( );

emit_sound( player, CHAN_BODY, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH );
}
}
}

case ROCKET:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
if ( is_user_alive( player ) )
{
emit_sound( player, CHAN_WEAPON, "weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );

engfunc( EngFunc_SetClientMaxspeed, player, 0.01 );
set_pev( player, pev_maxspeed, 0.01 );

set_task( 1.2, "rocket_liftoff", player );
}
}
}

case FIRE:
{
if ( !( get_user_flags( player ) & ADMIN_IMMUNITY ) || player == client )
{
if ( is_user_alive( player ) )
{
new Index[ 2 ];
Index[0] = player;

onfire[ player ] = true;

ignite_effects( Index );
ignite_player( Index );
}
}
}
}

log_amx( "Admin %s used %s Command [ !%s %s %s %s %s ]",
NameSz,
CommandsName[ command ],
CommandsInChat[ command ],
arg,
arg1,
arg2,
arg3
);
}

/* Rocket */

public rocket_liftoff( victim )
{
if ( !is_user_alive( victim ) )
return;

set_pev( victim, pev_gravity, -0.50 );

client_cmd( victim,"+jump;wait;wait;-jump" );

emit_sound( victim, CHAN_VOICE, "weapons/rocket1.wav", 1.0, 0.5, 0, PITCH_NORM );

rocket_effects( victim );
}

public rocket_effects( victim )
{
if ( !is_user_alive( victim ) )
return;

new vorigin[ 3 ];
get_user_origin( victim, vorigin );

message_begin( MSG_ONE, msgid_Damage, { 0, 0, 0 }, victim );
write_byte( 30 );
write_byte( 30 );
write_long( 1 << 16 );
write_coord( vorigin[ 0 ] );
write_coord( vorigin[ 1 ] );
write_coord( vorigin[ 2 ] );
message_end( );

if ( rocket_z[ victim ] == vorigin[ 2 ] )
{
rocket_explode( victim );
}

rocket_z[ victim ] = vorigin[ 2 ];

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( 15 );
write_coord( vorigin[ 0 ] );
write_coord( vorigin[ 1 ] );
write_coord( vorigin[ 2 ] );
write_coord( vorigin[ 0 ] );
write_coord( vorigin[ 1 ] );
write_coord( vorigin[ 2 ] - 30 );
write_short( blueflare2 );
write_byte( 5 );
write_byte( 1 );
write_byte( 1 );
write_byte( 10 );
write_byte( 5 );
message_end( );

message_begin( MSG_BROADCAST,SVC_TEMPENTITY);
write_byte( 17 );
write_coord(vorigin[0]);
write_coord(vorigin[1]);
write_coord(vorigin[2] - 30);
write_short( mflash );
write_byte( 15 );
write_byte( 255 );
message_end( );

set_task( 0.2, "rocket_effects", victim );
}

public rocket_explode( victim )
{
if ( is_user_alive( victim ) )
{
new vec1[ 3 ];
get_user_origin( victim, vec1 );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY, vec1);
write_byte( 21 );
write_coord( vec1[ 0 ] );
write_coord( vec1[ 1 ] );
write_coord( vec1[ 2 ] - 10 );
write_coord( vec1[ 0 ] );
write_coord( vec1[ 1 ] );
write_coord( vec1[ 2 ] + 1910 );
write_short( white );
write_byte( 0 );
write_byte( 0 );
write_byte( 2 );
write_byte( 16 );
write_byte( 0 );
write_byte( 188 );
write_byte( 220 );
write_byte( 255 );
write_byte( 255 );
write_byte( 0 );
message_end( );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
write_byte( 12 );
write_coord( vec1[ 0 ] );
write_coord( vec1[ 1 ] );
write_coord( vec1[ 2 ] );
write_byte( 188 );
write_byte( 10 );
message_end( );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY, vec1 );
write_byte( 5 );
write_coord( vec1[ 0 ] );
write_coord( vec1[ 1 ] );
write_coord( vec1[ 2 ] );
write_short( smoke );
write_byte( 2 );
write_byte( 10 );
message_end( );

user_kill( victim, 1 );
}

emit_sound( victim, CHAN_VOICE, "weapons/rocket1.wav", 0.0, 0.0, (1<<5), PITCH_NORM );

engfunc( EngFunc_SetClientMaxspeed, victim, 1.00 );

set_pev( victim, pev_maxspeed, 1.00 );
set_pev( victim, pev_gravity, 1.00 );
}

/* Fire */

public ignite_effects( skIndex[ ] )
{
new kIndex = skIndex[ 0 ];

if ( !( pev( kIndex, pev_flags ) & FL_INWATER ) )
{
if ( is_user_alive( kIndex ) && onfire[ kIndex ] )
{
new korigin[ 3 ];
get_user_origin( kIndex, korigin );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY);
write_byte( 17 );
write_coord( korigin[ 0 ] );
write_coord( korigin[ 1 ] );
write_coord( korigin[ 2 ] );
write_short( mflash );
write_byte( 20 );
write_byte( 200 );
message_end( );

message_begin( MSG_BROADCAST, SVC_TEMPENTITY, korigin );
write_byte( 5 );
write_coord( korigin[ 0 ] );
write_coord( korigin[ 1 ] );
write_coord( korigin[ 2 ] );
write_short( smoke );
write_byte( 20 );
write_byte( 15 );
message_end( );

set_task( 0.2, "ignite_effects" , 0 , skIndex, 2 );
}

else
{
if( onfire[ kIndex ] )
{
emit_sound( kIndex, CHAN_AUTO, "scientist/scream21.wav", 0.6, ATTN_NORM, 0, PITCH_HIGH );

onfire[ kIndex ] = false;
}
}
}

else
{
onfire[ kIndex ] = false;
}

return PLUGIN_CONTINUE;
}

public ignite_player( skIndex[ ] )
{
new kIndex = skIndex[ 0 ];

if (is_user_alive(kIndex) && onfire[kIndex] )
{
new korigin[ 3 ];
new players[ 32 ], inum = 0;
new pOrigin[ 3 ];

new kHeath = get_user_health( kIndex );

get_user_origin( kIndex, korigin );

fm_set_user_health( kIndex, kHeath - 10 );

message_begin( MSG_ONE, msgid_Damage, { 0, 0, 0 }, kIndex );
write_byte( 30 );
write_byte( 30 );
write_long( 1 << 21 );
write_coord( korigin[ 0 ] );
write_coord( korigin[ 1 ] );
write_coord( korigin[ 2 ] );
message_end( );

emit_sound( kIndex, CHAN_ITEM, "ambience/flameburst1.wav", 0.6, ATTN_NORM, 0, PITCH_NORM );

if ( get_pcvar_num( CvarFireIginite ) )
{
get_players( players, inum,"a" );

for( new i = 0 ; i < inum; ++i )
{
get_user_origin( players[ i ], pOrigin );

if( get_distance( korigin, pOrigin ) < 100 )
{
if( !onfire[ players[ i ] ] )
{
new spIndex[ 2 ] ;

spIndex[ 0 ] = players[ i ] ;

emit_sound( players[ i ], CHAN_WEAPON, "scientist/scream07.wav", 1.0, ATTN_NORM, 0, PITCH_HIGH );

onfire[ players[ i ] ] = true;

ignite_player( spIndex );
ignite_effects( spIndex );
}
}
}

players[ 0 ] = 0;
pOrigin[ 0 ] = 0;
korigin[ 0 ] = 0;
}

set_task( 2.0, "ignite_player" , 0 , skIndex, 2 );
}

return PLUGIN_CONTINUE;
}

/* Restart Server */

public RestartSvr( taskid )
{
server_cmd( "restart" );
}

/* UberSlap */
public TaskSlap( ids[ ] )
{
new client = ids[ 0 ];

user_slap( client, get_user_health( client ) > 1 ? 1 : 0 );
}

/* Events */

public EventCurWeapon( client )
{
if ( !is_user_connected( client ) || !is_user_alive( client ) )
return;

new Float:maxspeed;
pev( client, pev_maxspeed, maxspeed );

if( maxspeed != 1.0 )
{
if( g_speed[ client ] )
{
maxspeed *= 3.0;
}

else if( !g_freezetime )
{
switch( read_data( 2 ) )
{
case CSW_SCOUT: maxspeed = 260.0;
case CSW_P90: maxspeed = 245.0;
case CSW_XM1014,CSW_AUG,CSW_GALIL,CSW_FAMAS: maxspeed = 240.0;
case CSW_SG552 : maxspeed = 235.0;
case CSW_M3,CSW_M4A1 : maxspeed = 230.0;
case CSW_AK47 : maxspeed = 221.0;
case CSW_M249 : maxspeed = 220.0;
case CSW_AWP,CSW_SG550,CSW_G3SG1 : maxspeed = 210.0;
default : maxspeed = 250.0;
}
}

set_pev( client, pev_maxspeed, maxspeed );
}
}

public EventNewRound( )
{
g_freezetime = true;
}

public LogEventNewRound( )
{
g_freezetime = false;
}

/* Help MOTD */

public ShowMOTD( client, first, last )
{
new buffer[ 1536 ];

new len = formatex(buffer, sizeof( buffer ) - 1, "<body bgcolor=#FFFFFF><table width=100%% cellpadding=2 cellspacing=0>");
len += formatex(buffer[len], sizeof( buffer ) - 1 - len, "<tr align=center bgcolor=#52697B><th width=5%%> # <th width=20%%> Command <th width=20%%> Discription");

for (new i = first; i < last; i++ )
{
len += formatex( buffer[ len ], sizeof( buffer ) - 1 - len, "<tr align=center%s><td> %d <td> !%s <td> %s", ( ( i % 2 ) == 0 ) ? "" : " bgcolor=#A4BED6", i + 1, CommandsInChat[ i ], CommandsName[ i ] );
}

new info[ 21 ];

formatex( info, 20, " Amxx Cmd Advanced" );

show_motd( client, buffer, info );
}

/* Stocks */

stock fm_set_user_team(client, team)
{
set_pdata_int( client, 114, team );

static const TeamInfo[ Teams ][] =
{
"UNASSIGNED",
"TERRORIST",
"CT",
"SPECTATOR"
};

message_begin( MSG_ALL, get_user_msgid( "TeamInfo" ) ) ;
write_byte( client );
write_string( TeamInfo[ team ] );
message_end( );
}

stock fm_get_user_team( client )
{
return get_pdata_int( client, 114 );
}

stock fm_DispatchSpawn( client ) /* Fixed One */
{
if ( !is_user_connected( client ) || !pev_valid( client )
|| fm_get_user_team( client ) == FM_TEAM_UNASSIGNED )
{
return 0;
}

user_silentkill( client );

set_pev( client, pev_deadflag, DEAD_RESPAWNABLE );
dllfunc( DLLFunc_Think, client );

dllfunc( DLLFunc_Spawn, client );

return 1;
}

stock fm_set_user_health( client, health)
{
health > 0 ? set_pev( client, pev_health, float( health ) ) : dllfunc( DLLFunc_ClientKill, client );

return 1;
}

stock fm_set_user_rendering( client, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 )
{
new Float:RenderColor[ 3 ];

RenderColor[ 0 ] = float( r );
RenderColor[ 1 ] = float( g );
RenderColor[ 2 ] = float( b );

set_pev( client, pev_renderfx, fx );
set_pev( client, pev_rendercolor, RenderColor );
set_pev( client, pev_rendermode, render );
set_pev( client, pev_renderamt, float( amount ) );

return 1;
}

stock fm_set_user_noclip( client, noclip = 0 )
{
set_pev( client, pev_movetype, noclip == 1 ? MOVETYPE_NOCLIP : MOVETYPE_WALK );

return 1;
}

stock fm_set_user_godmode( client, godmode = 0 )
{
set_pev( client, pev_takedamage, godmode == 1 ? DAMAGE_NO : DAMAGE_AIM );

return 1;
}

stock give_weapon( id, weapon )
{
switch ( weapon )
{
case 1:
{
fm_give_item(id,weapons[WEAPON_KNIFE]);
}

case 11:
{
fm_give_item(id,weapons[WEAPON_GLOCK18]);
fm_give_item_x(id,"ammo_9mm",8);
}

case 12:
{
fm_give_item(id,weapons[WEAPON_USP]);
fm_give_item_x(id,"ammo_45acp",9);
}

case 13:
{
fm_give_item(id,weapons[WEAPON_P228]);
fm_give_item_x(id,"ammo_357sig",6);
}

case 14:
{
fm_give_item(id,weapons[WEAPON_DEAGLE]);
fm_give_item_x(id,"ammo_50ae",7);
}

case 15:
{
fm_give_item(id,weapons[WEAPON_FIVESEVEN]);
fm_give_item_x(id,"ammo_57mm",4);
}

case 16:
{
fm_give_item(id,weapons[WEAPON_ELITE]);
fm_give_item_x(id,"ammo_9mm",8);
}

case 17:
{
give_weapon(id,11);
give_weapon(id,12);
give_weapon(id,13);
give_weapon(id,14);
give_weapon(id,15);
give_weapon(id,16);
}

case 21:
{
fm_give_item(id,weapons[WEAPON_M3]);
fm_give_item_x(id,"ammo_buckshot",4);
}

case 22:
{
fm_give_item(id,weapons[WEAPON_XM1014]);
fm_give_item_x(id,"ammo_buckshot",4);
}

case 31:
{
fm_give_item(id,weapons[WEAPON_TMP]);
fm_give_item_x(id,"ammo_9mm",8);
}

case 32:
{
fm_give_item(id,weapons[WEAPON_MAC10]);
fm_give_item_x(id,"ammo_45acp",9);
}

case 33:
{
fm_give_item(id,weapons[WEAPON_MP5NAVY]);
fm_give_item_x(id,"ammo_9mm",8);
}

case 34:
{
fm_give_item(id,weapons[WEAPON_P90]);
fm_give_item_x(id,"ammo_57mm",4);
}

case 35:
{
fm_give_item(id,weapons[WEAPON_UMP45]);
fm_give_item_x(id,"ammo_45acp",9);
}

case 40:
{
fm_give_item(id,weapons[WEAPON_FAMAS]);
fm_give_item_x(id,"ammo_556nato",3);
}

case 41:
{
fm_give_item(id,weapons[WEAPON_GALIL]);
fm_give_item_x(id,"ammo_556nato",3);
}

case 42:
{
fm_give_item(id,weapons[WEAPON_AK47]);
fm_give_item_x(id,"ammo_762nato",3);
}

case 43:
{
fm_give_item(id,weapons[WEAPON_M4A1]);
fm_give_item_x(id,"ammo_556nato",3);
}

case 44:
{
fm_give_item(id,weapons[WEAPON_SG552]);
fm_give_item_x(id,"ammo_556nato",3);
}

case 45:
{
fm_give_item(id,weapons[WEAPON_AUG]);
fm_give_item_x(id,"ammo_556nato",3);
}

case 46:
{
fm_give_item(id,weapons[WEAPON_SCOUT]);
fm_give_item_x(id,"ammo_762nato",3);
}

case 47:
{
fm_give_item(id,weapons[WEAPON_SG550]);
fm_give_item_x(id,"ammo_556nato",3);
}

case 48:
{
fm_give_item(id,weapons[WEAPON_AWP]);
fm_give_item_x(id,"ammo_338magnum",3);
}

case 49:
{
fm_give_item(id,weapons[WEAPON_G3SG1]);
fm_give_item_x(id,"ammo_762nato",3);
}

case 51:
{
fm_give_item(id,weapons[WEAPON_M249]) ;
fm_give_item_x(id,"ammo_556natobox",7);
}

case 60:
{
fm_give_item(id,weapons[WEAPON_SHIELD]);
fm_give_item(id,weapons[WEAPON_GLOCK18]);
fm_give_item_x(id,"ammo_9mm",8);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 61:
{
fm_give_item(id,weapons[WEAPON_SHIELD]);
fm_give_item(id,weapons[WEAPON_USP]);
fm_give_item_x(id,"ammo_45acp",9);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 62:
{
fm_give_item(id,weapons[WEAPON_SHIELD]);
fm_give_item(id,weapons[WEAPON_P228]);
fm_give_item_x(id,"ammo_357sig",6);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 63:
{
fm_give_item(id,weapons[WEAPON_SHIELD]);
fm_give_item(id,weapons[WEAPON_DEAGLE]);
fm_give_item_x(id,"ammo_50ae",7);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 64:
{
fm_give_item(id,weapons[WEAPON_SHIELD]);
fm_give_item(id,weapons[WEAPON_FIVESEVEN]);
fm_give_item_x(id,"ammo_57mm",4);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 81:
{
fm_give_item(id,weapons[ITEM_KEVLAR]);
}

case 82:
{
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 83:
{
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
}

case 84:
{
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
}

case 85:
{
fm_give_item(id,weapons[WEAPON_SMOKEGRENADE]);
}

case 86:
{
fm_give_item(id,weapons[ITEM_THIGHPACK]);
}

case 87:
{
fm_give_item(id,weapons[WEAPON_SHIELD]);
}

case 88:
{
fm_give_item_x(id,"ammo_45acp",9);
fm_give_item_x(id,"ammo_357sig",6);
fm_give_item_x(id,"ammo_9mm",8);
fm_give_item_x(id,"ammo_50ae",7);
fm_give_item_x(id,"ammo_57mm",4);
fm_give_item_x(id,"ammo_buckshot",4);
fm_give_item_x(id,"ammo_556nato",3);
fm_give_item_x(id,"ammo_762nato",3);
fm_give_item_x(id,"ammo_338magnum",3);
fm_give_item_x(id,"ammo_556natobox",7);
}

case 89:
{
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_SMOKEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
}

case 91:
{
fm_give_item(id,weapons[WEAPON_C4]);
}

case 100:
{
fm_give_item(id,weapons[WEAPON_AWP]);
fm_give_item(id,weapons[WEAPON_DEAGLE]);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_SMOKEGRENADE]);
fm_give_item_x(id,"ammo_338magnum",3);
fm_give_item_x(id,"ammo_50ae",7);
fm_give_item(id,weapons[ITEM_ASSAULTSUIT]);
}

case 200:
{
fm_give_item(id,weapons[WEAPON_USP]);
fm_give_item(id,weapons[WEAPON_GLOCK18]);
fm_give_item(id,weapons[WEAPON_DEAGLE]);
fm_give_item(id,weapons[WEAPON_P228]);
fm_give_item(id,weapons[WEAPON_ELITE]);
fm_give_item(id,weapons[WEAPON_FIVESEVEN]);
fm_give_item(id,weapons[WEAPON_M3]);
fm_give_item(id,weapons[WEAPON_XM1014]);
fm_give_item(id,weapons[WEAPON_TMP]);
fm_give_item(id,weapons[WEAPON_MAC10]);
fm_give_item(id,weapons[WEAPON_MP5NAVY]);
fm_give_item(id,weapons[WEAPON_P90]);
fm_give_item(id,weapons[WEAPON_UMP45]);
fm_give_item(id,weapons[WEAPON_FAMAS]);
fm_give_item(id,weapons[WEAPON_GALIL]);
fm_give_item(id,weapons[WEAPON_AK47]);
fm_give_item(id,weapons[WEAPON_M4A1]);
fm_give_item(id,weapons[WEAPON_SG552]);
fm_give_item(id,weapons[WEAPON_AUG]);
fm_give_item(id,weapons[WEAPON_SCOUT]);
fm_give_item(id,weapons[WEAPON_SG550]);
fm_give_item(id,weapons[WEAPON_AWP]);
fm_give_item(id,weapons[WEAPON_G3SG1]);
fm_give_item(id,weapons[WEAPON_M249]);
fm_give_item_x(id,"ammo_45acp",9);
fm_give_item_x(id,"ammo_357sig",6);
fm_give_item_x(id,"ammo_9mm",8);
fm_give_item_x(id,"ammo_50ae",7);
fm_give_item_x(id,"ammo_57mm",4);
fm_give_item_x(id,"ammo_buckshot",4);
fm_give_item_x(id,"ammo_556nato",3);
fm_give_item_x(id,"ammo_762nato",3);
fm_give_item_x(id,"ammo_338magnum",3);
fm_give_item_x(id,"ammo_556natobox",7);
fm_give_item(id,weapons[WEAPON_HEGRENADE]);
fm_give_item(id,weapons[WEAPON_SMOKEGRENADE]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
fm_give_item(id,weapons[WEAPON_FLASHBANG]);
}

default:
{
return false;
}
}

return true;
}

stock fm_give_item_x( client, const item[], x )
{
for ( new i = 0; i <= x; i++ )
{
fm_give_item( client, item );
}
}

stock fm_give_item( client, const item[] )
{
if ( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 )
&& !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
return 0;

new ent = fm_create_entity( item );

if ( !pev_valid( ent ) )
return 0;

new Float:origin[3];

pev( client, pev_origin, origin );

set_pev( ent, pev_origin, origin );
set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN );

dllfunc( DLLFunc_Spawn, ent );

new save = pev( ent, pev_solid );

dllfunc( DLLFunc_Touch, ent, client );

if ( pev( ent, pev_solid ) != save )
return ent;

engfunc( EngFunc_RemoveEntity, ent );

return -1;
}

stock fm_create_entity( const classname[] )
{
return engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, classname ) );
}

stock cmd_target( client, const arg[], const arg1[], command )
{
if ( !equal( arg1, "" )
|| command == T_TRANSFER
|| command == CT_TRANSFER
|| command == SPEC_TRANSFER
|| command == REVIVE
|| command == BURY
|| command == UNBURY
|| command == SLAY
|| command == SLAP
|| command == UBERSLAP
|| command == DRUG
|| command == FLASH
|| command == ROCKET
|| command == FIRE )
{
new player = find_player( "bl",arg );

if ( player )
{
if ( player != find_player( "blj",arg ) )
{
ColorChat( client, "^3Error^1: There are more than 1 player with that name" );

return 0;
}
}

else if ( ( player = find_player( "c",arg ) ) ==0 && arg[ 0 ] == '#' && arg[ 1 ] )
{
player = find_player( "k",str_to_num( arg[ 1 ] ) );
}

if ( !player )
{
ColorChat( client, "^3Error^1: There is no such a player" );

return 0;
}

return player;
}
return 0;
}

stock fm_set_user_money( client, money, flash = 0 )
{
new CSMONEY;

#if cellbits == 32
CSMONEY = 115;
#else
CSMONEY = 140;
#endif

set_pdata_int( client, CSMONEY, money, 5 );

message_begin( MSG_ONE,get_user_msgid( "Money" ), { 0, 0, 0 }, client );
write_long( money );
write_byte( flash );
message_end( );
}

stock fm_set_user_model( const client, const model[] )
{
engfunc( EngFunc_SetClientKeyValue, client, engfunc( EngFunc_GetInfoKeyBuffer, client ), "model", model );
}

stock ColorChat( const client, const string[ ], { Float, Sql, Resul,_ }:... )
{
new msg[191], players[32], count = 1;

static len; len = formatex( msg, charsmax( msg ), "^4[ Amxx Cmd Advanced ]^1 " );
vformat( msg[ len ], charsmax( msg ) - len, string, 3 );

if( client )
{
players[ 0 ] = client;
}

else
{
get_players( players,count,"ch" );
}

for ( new i = 0; i < count; i++ )
{
if( is_user_connected( players[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
write_byte( players[ i ] );
write_string( msg );
message_end( );
}
}
}


which allow me to run commands from the chat (say)

what i want to do is be able to do commands on teams or all players on the server like amx spuer commands

example:

!strip @ct - strips all players in the ct team
!flash @all - flash all players
etc.

how could i do it?
thanks :D

if you could show me how to do it for 1 command iil do it for the rest of them, thanks!