I don't know about Phil's code, but if you decide to try mine out, this is the results i've gotten when set to 20%:
2 out of 8 (8 / 5 == 1.6)
1 out of 6 (6 / 5 == 1.2)
2 out of 10 (10 / 5 == 2)
I also tweaked it a little bit, because Phil found out viewing an integer as a float messed things up.
PHP Code:
ArrayList client_list = new ArrayList(1, MaxClients);
int count;
int num_clients = RoundToNearest(float(GetTeamClientCount(2)) / 5.0);
for(int i = 1; i <= MaxClients; i++) {
if(IsClientInGame(i) && (GetClientTeam(i) == 2)) {
client_list.Set(count++, i);
}
}
int index;
for(int i = 0; i < num_clients; i++) {
index = GetRandomInt(0, count--);
TF2_ChangeClientTeam(client_list.Get(index), TFTeam_Blue);
client_list.Erase(index);
}
delete client_list;
__________________