Difference between revisions of "TActivePlayer.OnDamage"

From Soldat Community Wiki
Jump to: navigation, search
(Created page with " '''''property OnDamage''''' Access mode: RW Event handler type: TOnDamageEvent Event handler declaration: function (Shooter, Victim: TActivePlayer; Damage: Integer;...")
 
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
   Access mode: RW
 
   Access mode: RW
 
   Event handler type: [[TOnDamageEvent]]
 
   Event handler type: [[TOnDamageEvent]]
   Event handler declaration: function (Shooter, Victim: TActivePlayer; Damage: Integer; WeaponType: Byte): Integer
+
   Event handler declaration: function ('''Shooter''', '''Victim''': TActivePlayer; '''Damage''': Single; '''BulletId''': Byte): Single
  
 
==Description==
 
==Description==
Line 10: Line 10:
 
Example ignores all damage dealt, players become invincible.
 
Example ignores all damage dealt, players become invincible.
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
function OnDamageZero(Shooter, Victim: TActivePlayer; Damage: Integer; WeaponType: Byte): Integer
+
function OnDamageZero(Shooter, Victim: TActivePlayer; Damage: Single; BulletId: Byte): Single
 
begin
 
begin
 
   Result := 0;
 
   Result := 0;

Latest revision as of 11:41, 10 July 2016

property OnDamage
 Access mode: RW
 Event handler type: TOnDamageEvent
 Event handler declaration: function (Shooter, Victim: TActivePlayer; Damage: Single; BulletId: Byte): Single

Description

Event property called when a player is hurt, whether from a killing poly, bullet or command.

Example

Example ignores all damage dealt, players become invincible.

function OnDamageZero(Shooter, Victim: TActivePlayer; Damage: Single; BulletId: Byte): Single
begin
  Result := 0;
end;

var 
  i: Byte;
begin
  for i:=1 to 32 do
    Players[i].OnDamage := @OnDamageZero;
end.