Author Topic: Kill out of bounds respawners  (Read 1901 times)

0 Members and 1 Guest are viewing this topic.

Offline deguix

  • Major
  • *
  • Posts: 79
Kill out of bounds respawners
« on: September 13, 2007, 06:25:55 am »
Script Name: Kill Out of Bounds Respawners
Script Description: Kills players that go out of bounds, thus  preventing them from re-healing again (like many times done in realistic/survival matches @ ctf_voland...)
Original Author(s): deguix
Core Version: 2.6.2
Code:
Code: [Select]
type
  trPlayer = record
    Alive : Boolean;
    KillRespawn : Boolean;
  end;

var
  aPlayers: array [1..32] of trPlayer;

procedure AppOnIdle(Ticks: integer);
var
  i:Integer;
begin
  for i:=1 to 32 do
    if (GetPlayerStat(i,'Active') = True) and aPlayers[i].KillRespawn then begin
      DoDamage(i,4000);
      aPlayers[i].KillRespawn := False;
    end;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
  aPlayers[ID].Alive := False;
  aPlayers[ID].KillRespawn := False;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
begin
  aPlayers[Victim].Alive := False;
end;

procedure OnPlayerRespawn(ID: byte);
begin
  if aPlayers[ID].Alive then
    aPlayers[ID].KillRespawn := True;
  aPlayers[ID].Alive := True;
end;