I could have sworn I posted this before, in the other thread... Ugh, I fail.
procedure ChangeTeams;
var
i: Integer; // used for loops
j, k: Integer; // used for team scores
holder: Array[1..32] of Integer; // store scores
begin
// first, save the score in an array
for i := 1 to 32 do
if GetPlayerStat(i, 'Active') = true then
holder[i] := GetPlayerStat(i, 'Kills');
// And team scores
j := AlphaScore;
k := BravoScore;
// then, move all to bravo
for i := 1 to 32 do
if GetPlayerStat(i, 'Active') = true then
Command('/setteam2 ' + inttostr(i));
// Move random player back to alpha
while AlphaPlayers < 1 do
Command('/setteam1 ' + inttostr(Random(1, 32)));
// Set the scores again
for i := 1 to 32 do
if GetPlayerStat(i, 'Active') then
SetScore(i, holder[i]);
// Set team scores
SetTeamScore(1, j);
SetTeamScore(2, k);
end;