Author Topic: procedure SetVest(ID, HP: byte);  (Read 1380 times)

0 Members and 1 Guest are viewing this topic.

Offline Gizd

  • Flagrunner
  • ****
  • Posts: 586
  • (Re)tired
    • Eat-this! community site
procedure SetVest(ID, HP: byte);
« on: December 09, 2009, 02:12:23 pm »
Original Author(s): Gizd
Core Version: 2.7.0
Description: This procedure sets player's vest health to a value.
ID - ID of player
HP - vest health value(0-100)
If player had no vest before this procedure will erase default texts on screen(you killed.. etc).

Code: [Select]
procedure SetVest(ID, HP: byte);
var
  sHP, sV: byte;
begin
  sHP:= GetPlayerStat(ID,'Health');
  sV:= GetPlayerStat(ID,'Vest');
  while sV <> HP do begin
    if sV = 0 then begin
      GiveBonus(ID, 3);   
      DrawText(ID,1,'   ',1,$000000,1,0,0);
      sV:= 100;
    end;
    SetPlayerStat(ID,'Health', 200);
    DoDamage(ID,ID,(sV - HP)*3);
    sV:= GetPlayerStat(ID,'Vest');
  end;
  SetPlayerStat(ID,'Health', sHP);
end;