Heres something I wrote with Neosano, maybe it helps you
Why using arrays when you can also just check how much are need and add/kick them instead of
calculating arrays, checking if enough bots are here or not and add/kick them.
procedure BalanceBots(Add, Remove: String; Need, Players: integer);
var Current, Mustbe: integer; i, j: byte;
begin
Current := 0;
for i := 1 to 32 do
if GetPlayerStat(i, 'Active') = True then
if GetPlayerStat(i, 'Human') = False then
if IDToName(i) = Add then
Current := Current + 1;
Mustbe := Players DIV Need;
if Mustbe < Current then
while Mustbe < Current do begin
Mustbe := Mustbe + 1;
KickPlayer(NameToID(Add));
Command('/addbot2 ' + Remove);
end;
if Mustbe > Current then
while Mustbe > Current do begin
Mustbe := Mustbe - 1;
KickPlayer(NameToID(Remove));
Command('/addbot2 ' + Add);
end;
end;
You could set Players to the sum of the players levels and use Need for the level amount needed for the zombie.