Assassination Vacation
March 28, 2024, 02:05:19 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: All members must have xFire!
 
  Home Help Search Gallery Staff List Members Login Register  

Medic for TW

Pages: [1]
  Print  
Author Topic: Medic for TW  (Read 268 times)
Ecko
/\\/ Member
Danko
**
Posts: 29


Noob Ecko xD


View Profile
« on: August 28, 2007, 10:06:35 am »

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 Undecided


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:
Quote
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.
Report Spam   Report to moderator   Logged

Share on Facebook Share on Twitter

iDante
Administrator
Danko
*****
Posts: 31


Pwnzer


View Profile
« Reply #1 on: August 28, 2007, 01:44:21 pm »

Actually... I just tried it out on a self-hosted dedicated server and it didnt work. Didnt even compile. I'll check it out and get back to you.
Report Spam   Report to moderator   Logged

- iDante
braco1127
/\\/ Captain
Danko
***
Posts: 76


View Profile
« Reply #2 on: September 15, 2007, 10:04:44 pm »

hey Idante r u good with scripts,
if ya got sum time meby u can teach me sum of da stuff for it
u 2 ecko
Report Spam   Report to moderator   Logged

Pages: [1]
  Print  
 
Jump to:  

Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy