can someone test this for me and see if it works
if it does we could use it on our server, if Dizzy allows it
Script Name: Health Regeneration Around Medic
Script Description: First player to do !medic becomes the medic. Anybody around the medic will be healed at a specified rate. When the map changes, medic is replaced, and may be reclaimed by anybody. There is a limitation of 1 medic per team. The script is designed for CTF mode, although may be easily modified for team match.
Original Author: Curt (DorkeyDear)
Core Version: 2.6.2
Code:
const
Color = $FFFFFFFF;
MaxDist = 65;
MaxHealth = 65;
HealRate = 8;
var
Medic: array[1..2] of byte;
procedure AppOnIdle(Ticks: integer);
var
i,j: byte;
X,Y: single;
begin
for i := 1 to 2 do begin
GetPlayerXY(Medic,X,Y);
if Medic <> 0 then if GetPlayerStat(Medic,'Alive') = true then for j := 1 to 32 do if (GetPlayerStat(j,'Active') = true) and (GetPlayerStat(j,'Alive') = true) and (GetPlayerStat(Medic,'Team') = GetPlayerStat(j,'Team')) and (Distance(X,Y,GetPlayerStat(j,'X'),GetPlayerStat(j,'Y')) <= MaxDist) and (GetPlayerStat(j,'Health') < MaxHealth) then begin
if GetPlayerStat(j,'Health') + HealRate > MaxHealth then DoDamage(j,GetPlayerStat(j,'Health') - MaxHealth) else DoDamage(j,-HealRate);
end;
end;
end;
procedure OnJoinGame(ID, Team: byte);
begin
if Medic[Team] = 0 then WriteConsole(ID,'Medic is up for grabs on your team. Type !medic to claim it.',Color);
end;
procedure OnJoinTeam(ID, Team: byte);
var
OTeam: byte;
begin
if Team = 1 then OTeam := 2 else OTeam := 1;
if Medic[OTeam] = ID then begin
Medic[OTeam] := 0;
WriteConsole(0,'Medic for team #' + InttoStr(OTeam) + ' is up for grabs. Type !medic to claim it.',Color);
end;
end;
procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
if Medic[Team] = ID then begin
Medic[Team] := 0;
WriteConsole(0,'Medic for team #' + InttoStr(Team) + ' is up for grabs. Type !medic to claim it.',Color);
end;
end;
procedure OnMapChange(NewMap: string);
var
i: byte;
begin
for i := 1 to 2 do Medic := 0;
WriteConsole(0,'Medic is now up for grabs for both teams. Type !medic to claim it.',Color);
end;
procedure OnPlayerSpeak(ID: byte; Text: string);
var
Team: byte;
begin
if (Text = '!medic') then begin
Team := GetPlayerStat(ID,'Team');
if Medic[Team] = 0 then begin
Medic[Team] := ID;
WriteConsole(ID,GetPlayerStat(ID,'Name') + ' has claimed medic for team #' + InttoStr(Team) + '.',Color);
end else WriteConsole(ID,'Medic has already been claimed by ' + GetPlayerStat(Medic[Team],'Name') + '.',Color);
end;
end;
# Full health in realistic mode is 65, and in unrealistic mode is 150.