Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 1st, 2012  |  syntax: None  |  size: 3.06 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. const
  2.   HpHealed= 10;       //hp regenerated per heal
  3.   HealForPoint= 200; //how much hp medic must heal to get 1 point (hp in realistic is 65)
  4.   HealDistance= 240;  //distance of heal (in strange units, 14=1m or sth)
  5.   Color= $44AA44;    //color of msgs
  6.  
  7. var
  8.   Medic: array[1..2] of byte;
  9.   Healed: array[1..2] of integer;
  10.   MaxHP: byte;
  11.  
  12. procedure Reset;
  13. begin
  14.   if Command('/realistic') = 1 then MaxHP:= 65 else MaxHP:= 150;
  15.   Medic[1]:= 0;
  16.   Medic[2]:= 0;
  17.   Healed[1]:= 0;
  18.   Healed[2]:= 0;
  19. end;
  20.  
  21. procedure ActivateServer();
  22. begin
  23.   Reset;
  24. end;
  25.  
  26. procedure OnMapChange(NewMap: string);
  27. begin
  28.   Reset;
  29.   WriteConsole(0,'Medic position is now free. Write !medic to apply.',Color);
  30. end;
  31.  
  32. procedure MedicQuit(Team: byte);
  33. begin
  34.   WriteConsole(0,IDToName(Medic[Team])+' is no longer the '+iif(Team=1,'alpha','bravo')+' team''s medic!',iif(Team=1,$ff5555,$00AAAA));
  35.   Medic[Team]:= 0;
  36.   Healed[Team]:= 0;
  37. end;
  38.  
  39. procedure Heal(Team: byte);
  40. var
  41.   HP: integer;
  42.   i: byte;
  43. begin
  44.   for i:= 1 to 32 do if GetPlayerStat(i,'Active') = true then if GetPlayerStat(i,'Alive') = true then if GetPlayerStat(i,'Health') < MaxHP then
  45.    if Team = GetPlayerStat(i,'Team') then if
  46.     Distance(GetPlayerStat(Medic[Team],'X'),GetPlayerStat(Medic[Team],'Y'),GetPlayerStat(i,'X'),GetPlayerStat(i,'Y')) <= HealDistance then begin
  47.  
  48.     DrawText(Medic[Team],'Healing',60,Color,0.1,160,350);
  49.     if GetPlayerStat(i,'Health') <= (MaxHP-HpHealed) then HP:= 8 else HP:= MaxHP-GetPlayerStat(i,'Health');
  50.     DoDamage(i,-HP);
  51.     if Medic[Team] <> i then begin
  52.       inc(Healed[Team],HP);
  53.       if Healed[Team] > HealForPoint then begin
  54.         WriteConsole(Medic[Team],'You got 1 point for healing.',$fffffa);
  55.         SetScore(Medic[Team],GetPlayerStat(Medic[Team],'Kills')+1);
  56.         Healed[Team]:= 0;
  57.       end;
  58.     end;
  59.   end;
  60. end;
  61.  
  62. procedure OnPlayerSpeak(ID: byte; Text: string);
  63. var T: byte;
  64. begin
  65.   if RegExpMatch('^!(medic|med|medi)$',LowerCase(Text)) then if (GetPlayerStat(ID,'Team')=1) or (GetPlayerStat(ID,'Team')=2) then begin
  66.     T:= GetPlayerStat(ID,'Team');
  67.     if Medic[T]=0 then begin
  68.       WriteConsole(0,IDToName(ID)+' is now the '+iif(T=1,'alpha','bravo')+' team''s medic!',iif(T=1,$ff5555,$00AAAA));
  69.       Medic[T]:= ID;
  70.     end else if Medic[T] = ID then begin
  71.       MedicQuit(T);
  72.     end else WriteConsole(ID,IDToName(Medic[T])+' is already your team''s medic!',$fffffa);
  73.   end;
  74. end;
  75.  
  76. procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
  77. begin
  78.   if (Team = 1) or (Team = 2) then if ID = Medic[Team] then MedicQuit(Team);
  79. end;
  80.  
  81. procedure OnJoinTeam(ID, Team: byte);
  82. begin
  83.   if (Medic[1]=ID) or (Medic[2]=ID) then MedicQuit(iif(Medic[1]=ID,1,2));
  84.   if (Team = 1) or (Team = 2) then if Medic[Team]=0 then WriteConsole(ID,'Medic position is free. Write !medic to apply.',$fffffa) else
  85.    WriteConsole(ID,IDToName(Medic[Team]) + ' is your team''s medic.',$fffffa);
  86. end;
  87.  
  88. procedure OnWeaponChange(ID, PrimaryNum, SecondaryNum: byte);
  89. begin
  90.   if (Medic[1]=ID) or (Medic[2]=ID) then if GetPlayerStat(ID,'Health') > 0 then Heal(iif(Medic[1]=ID,1,2));
  91. end;