Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGINNAME "Clan VS"
#define VERSION "1.0"
#define AUTHOR "Nightscream"
public plugin_init()
{
register_plugin( "Clan VS", "1.0", "Nightscream" )
register_concmd( "amx_clanvs", "clanvs", ADMIN_KICK, "<Tag> <CT|T>" )
register_cvar("clanvs_debug","0")
}
public clanvs(id,level,cid)
{
if(get_cvar_num("clanvs_debug")==1)
{
client_print(id,print_chat,"[DEBUG] You entered the command")
}
if(!cmd_access(id,level,cid,3))
{
return PLUGIN_HANDLED
}
if(get_cvar_num("clanvs_debug")==1)
{
client_print(id,print_chat,"[DEBUG] The command passed args")
}
new arg[32], name[32]
read_argv( 2, arg, 31 )
new arg2[32]
read_argv( 3, arg2, 31 )
new players[32],pnum
get_players(players,pnum)
for(new i = 0; i <= pnum; i++) {
if(get_cvar_num("clanvs_debug")==1)
{
client_print(id,print_chat,"[DEBUG] The command is being processed to check players")
}
get_user_name(players[i], name, 31 )
if( containi( name, arg )!=-1 )
{
if(get_cvar_num("clanvs_debug")==1)
{
client_print(id,print_chat,"[DEBUG] A player as been detected with the clan tag")
}
if ( equal ( arg2, "CT" ) )
{
cs_set_user_team( players[i], CS_TEAM_CT )
}
if (equal ( arg2, "T" ) )
{
cs_set_user_team( players[i], CS_TEAM_T )
}
}else{
if( equal ( arg2, "CT" ) )
{
cs_set_user_team( players[i], CS_TEAM_T )
}
if( equal ( arg2, "T" ) )
{
cs_set_user_team( players[i], CS_TEAM_CT )
}
}
if(get_cvar_num("clanvs_debug")==1)
{
client_print(id,print_chat,"[DEBUG] Player checking finished")
}
}
return PLUGIN_HANDLED
}