Advertisement
Guest User

Untitled

a guest
May 16th, 2016
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.45 KB | None | 0 0
  1. unit Test;
  2.  
  3. interface
  4.  
  5. implementation
  6. var Decl: byte;
  7.  
  8. const
  9.     FullHeal            = 150;
  10.     MaxHealth           = 65;
  11.  
  12. var
  13.     PlayerHealth: array [1..32] of integer;
  14.  
  15. function HeadShootKill(Shooter, Victim: TActivePlayer; Damage: Integer; Bullet: byte): Integer;
  16. var s,c: integer;
  17. begin
  18.     c:=0;
  19.     s:=FullHeal;
  20.    
  21.     PlayerHealth[Victim.ID] := (PlayerHealth[Victim.ID] - damage);
  22.    
  23.     Players.BigText(1,'Damage: '+inttostr(damage),140,$FD3C20,0.055,12,375);
  24.    
  25.     c := Round(single(PlayerHealth[Victim.ID] * MaxHealth)/single(s));
  26.     c :=(Victim.Health - c);
  27.     Players.BigText(2,'C: '+inttostr(c),140,$FD3C20,0.055,12,355);
  28.    
  29.     Result := c;
  30. end;
  31.  
  32. procedure OnAfterRespawn(Player: TActivePlayer);
  33. begin
  34.     PlayerHealth[Player.ID]:=FullHeal;
  35.     Player.GiveBonus(3);
  36. end;
  37.  
  38. procedure AppOnIdleS2(Ticks: integer);
  39. var i: byte;
  40. begin
  41.     for i:= 1 to 32 do if (Players[i].Active) then begin
  42.         if (Players[i].Team<5) then begin
  43.             Players[i].BigText(3,'Heal +: '+inttostr(Round((PlayerHealth[i]/150.0)*100))+'%, ('+inttostr(PlayerHealth[i])+')',40,$FD3C20,0.055,12,395);
  44.             Players[i].BigText(4,'Heal Real: '+inttostr(Round((Players[i].Health/65.0)*100))+'%, ('+inttostr(Players[i].Health)+')',40,$FD3C20,0.055,12,385);
  45.         end;
  46.     end;
  47. end;
  48.  
  49. initialization
  50. begin
  51.     Game.TickThreshold := 1;
  52.     Game.OnClockTick := @AppOnIdleS2;
  53.     for Decl := 1 to 32 do begin
  54.         Players[Decl].OnDamage := @HeadShootKill;
  55.         Players[Decl].OnAfterRespawn := @OnAfterRespawn;
  56.     end;
  57. end;
  58.  
  59. finalization;
  60. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement