Thanks, I figured I was going to have to use a for loop but I wasn't sure if there was already a pre-defined function that would just retrieve the number or not. Guess not, but I do have a question...
Here's what my code looks like so far:
Code:
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_menucmd(register_menuid("Team_Select"), MENU_KEY_1 | MENU_KEY_2, "jointeam")
register_clcmd("jointeam 1", "jointeam")
register_clcmd("jointeam 2", "jointeam")
register_clcmd("jointeam 5", "jointeam")
}
Code:
public jointeam()
{
new red_players, blue_players, x, numplayers
numplayers = get_playersnum()
for(x=0; x<=32; x++)
{
if( get_user_team(x) == 2 )
{
blue_players = blue_players + 1
set_cvar_num("cr_demoman", -1)
}else if (get_user_team(x) == 1 )
{
red_players = red_players +1
set_cvar_num("cr_sniper", -1)
}
}
}
Thanks to you, I was able to get the number of players per team working. HOWEVER, the problem i'm now having is that the above code only exectues when a player CHANGES teams, rather then joins teams. So, if I join a server with the above code running, and I pick "Team 1" nothing will happen. If however after I spawn I join team 2, and then join team 1 again the "team 1" code will work. How can I fix this so that it'll execute the code whenever the player chooses the team, rather then switches to the team?