All pastes #976753 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-04-08 12:21 UTC
rendered paste body
// inf enhancer v0.1

var
score: array[1..2] of integer; 
  alphaplayer: integer;


procedure MoveAllToBravo();
var i: Integer;
begin
  alphaplayer := 0;
  
// First, check if there are any alpha players and select the first one
for i := 1 to 32 do
if GetPlayerStat(i,'Active') = true then begin
if GetPlayerStat(i,'Team') = 1 then begin
if alphaplayer = 0 then begin
alphaplayer := i;
break;
end;
end;
end;

  // Looping through players to put them all on blue team
for i := 1 to 32 do
if (GetPlayerStat(i,'Active') = true) then begin
if (GetPlayerStat(i,'Team') = 1) then begin
if alphaplayer <> i then begin
Command('/setteam2 ' + inttostr(i));
end;
end;
end;

for i := 1 to 32 do
if (GetPlayerStat(i,'Active') = true) then begin
if (GetPlayerStat(i,'Team') = 2) then begin
if alphaplayer = 0 then begin
alphaplayer := i;
Command('/setteam1 ' + inttostr(i));
break;
end;
end;
end;

end;


procedure OnFlagScore(ID, TeamFlag: Byte);
begin
  // if its alpha flag
if TeamFlag = 2 then begin
MoveAllToBravo();
end;
  
end;


// This will run every time a player is killed
procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
var i: byte;
begin
  // if the victim is on team two, move to team one
  if GetPlayerStat(Victim, 'Team') = 2 then begin
    score[2] := BravoScore; // saving bravo score
    Command('/setteam1 ' + IntToStr(Victim)); //sets bravo player to alpha team

    // When all Bravo players killed
    if BravoPlayers = 0 then begin
      SetTeamScore(1, AlphaScore + 25); // add score to alpha
      MoveAllToBravo(); // moves all players but one to bravo
      SetTeamScore(2, score[2]) /restores bravo's score if lost
    end;
    
  end;
  
end;