Posts: 916
Threads: 65
Joined: Jun 2011
07-22-2011, 14:40
(This post was last modified: 07-22-2011, 14:42 by Scripts18.)
Code:
CountPlayers()
{
players = level.players;
allies = 0;
axis = 0;
for(i = 0; i < players.size; i++)
{
if ( players[i] == self )
continue;
if((isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "allies"))
allies++;
else if((isdefined(players[i].pers["team"])) && (players[i].pers["team"] == "axis"))
axis++;
}
players["allies"] = allies;
players["axis"] = axis;
return players;
}
When using this and printing what it does to the screen
(playing with bots on 6v6)
Teams are always 5-6 or 6-5 (they switched all the time but never 6-6)
any one knows how to fix that?
Posts: 916
Threads: 65
Joined: Jun 2011
07-22-2011, 15:05
(This post was last modified: 07-22-2011, 15:12 by Scripts18.)
Hu... you only copied what I wrote and pasted it again...
Posts: 474
Threads: 67
Joined: May 2011
Reputation:
11
if ( players[i] == self )
continue;
it doesnt count you, that is why... remove that section and it will count all players correctly.
Posts: 916
Threads: 65
Joined: Jun 2011
07-22-2011, 15:45
(This post was last modified: 07-22-2011, 15:49 by Scripts18.)
(07-22-2011, 15:43)koil Wrote: if ( players[i] == self )
continue;
it doesnt count you, that is why... remove that section and it will count all players correctly.
thx and pyro I tried and his code doesnt work..
works