Hmm this works fine for me.
var
Killed : array[1..32] of boolean;
Total, TotalB : integer;
procedure OnPlayerKill(Killer, Victim: byte; Weapon: String);
begin
if GetPlayerStat(Victim,'Team') = 1 and GetPlayerStat(Victim,'Human') then begin
Killed[Victim] := true;
WriteConsole(0, 'Player ' + IdToName(Victim) + ' has been killed by an zombie and is now infected.', $123456);
Command('/setteam2 ' + IntToStr(Victim));
TotalB := TotalB +1;
end;
end;
procedure OnMapChange(NewMap: String);
var
i : integer;
begin
TotalB := 0;
if GetPlayerStat(i,'Human') then
Command('/setteam1 ' + IntToStr(i))
for i := 1 to 32 do if GetPlayerStat(i,'Human') then Command('/setteam1 ' + IntToStr(i));
end;
procedure OnJoinTeam(ID, Team: byte);
var
i : integer;
begin
if (Killed[ID]) and (Team <> 5) and (Team <> 2) then begin
Command('/setteam2 ' + IntToStr(ID));
WriteConsole(ID, 'You are infected!', $123456);
end else if not (Killed[ID]) and (Team <> 1) and (Team <> 5) then Command('/setteam1 ' + IntToStr(ID));
if Total = TotalB then begin
WriteConsole(0, 'Everyone has been infected!!!', $123456);
for i := 1 to 32 do
Killed[i] := false;
Command('/nextmap');
end;
end;
procedure OnJoinGame(ID, Team: byte);
begin
if GetPlayerStat(ID,'Human') then
Total := Total +1;
end;