I've tested this and it works fine.
I think it's a little more optimize.
Code:
/*
Description - If you On this plugin Terrorist's are red ,ct's are blue
Cvars - ncs_enabled <1|0>
1 = on
0 = off
Command - amx_newcolorskins <1|0>
1 = on
0 = off
********************************************* ***********************
*/
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#define PLUGIN "Color Skins"
#define VERSION "1.0"
#define AUTHOR "Inogood"
#define COLOR_LEVEL ADMIN_BAN
new togglecolor
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
togglecolor = register_cvar("ncs_enabled","1")
register_concmd("amx_newcolorskins","cmd_toggle" ,COLOR_LEVEL,"- <1=on 0=off> : Turn color skins on and off (default ON)")
new parm[1]
set_task(0.1,"loop",0,parm,1,"b")
}
public cmd_toggle(id, level, cid)
{
new arg, arg1[32]
if(id)
{
if(!cmd_access(id,level,cid,2))
return PLUGIN_HANDLED
read_argv(1,arg1,31)
}
else
format(arg1,31,"%d",level)
set_hudmessage(200, 100, 0, -1.0, 0.25, 0, 1.0, 7.0, 0.1, 0.2, 2)
arg = str_to_num(arg1)
switch(arg)
{
case 0 :
{
if( !get_pcvar_num(togglecolor) )
console_print(id,"[COLOR SKIN] Plugin already enabled.")
else
{
new players[32], inum
get_players(players,inum)
for(new a=0;a<inum;++a)
set_user_rendering(players[a],kRenderFxNone,0,0,0,kRenderTransTexture,255)
console_print(id,"T's and CT's will now stop glowing.")
show_hudmessage(0,"T's and CT's will now stop glowing...")
set_pcvar_num(togglecolor,0)
}
}
case 1 :
{
if( get_pcvar_num(togglecolor) )
console_print(id,"[COLOR SKIN] Plugin already enabled.")
else
{
console_print(id,"T's will now glow red and CT's will now glow blue.")
show_hudmessage(0,"T's now glow red and CT's now glow blue...")
set_pcvar_num(togglecolor,1)
}
}
}
return PLUGIN_HANDLED
}
public loop(parm[])
{
if( !get_pcvar_num(togglecolor) ) return PLUGIN_HANDLED
new players[32], inum
get_players(players,inum)
for( new a = 0;a < inum; ++a )
{
new CsTeams:userTeam = cs_get_user_team(players[a])
switch(userTeam)
{
case CS_TEAM_CT : set_user_rendering(players[a],kRenderFxGlowShell,0,0,255,kRenderNormal,40)
case CS_TEAM_T : set_user_rendering(players[a],kRenderFxGlowShell,255,0,0,kRenderNormal,40)
}
}
return PLUGIN_CONTINUE
}