onPedInflictDamage

Revision as of 22:51, 24 August 2023 by Mex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Event Client Only icon-iii.png icon-vc.png icon-sa.png Online and Offline Cancellable

Available since Client 1.0.0

onPedInflictDamage(Event event, Ped ped, Entity responsibleEntity, int weapon, float loss, int pedPiece)

The onPedInflictDamage event is invoked when a ped is damaged.

Parameters

1) Event event The event object for this event.
2) Ped ped The ped that has been damaged.
3) Entity responsibleEntity The entity that is responsible for the damage.
4) int weapon The weapon ID for the damage.
5) float loss The ped health lost for the damage.
6) int pedPiece The ped piece ID for the damage.

Attributes

cancellable This event can be cancelled, by using event.preventDefault.

Notes

There aren't any notes for this event.

Examples

Example 1 - JavaScript - Client-Side:

addEventHandler('onPedInflictDamage', function(event, ped, responsibleEntity, weapon, loss, pedPiece)
{
    // Prevent the ped from being damaged.
    event.preventDefault();
});

Compatibility

There isn't any compatibility information for this event.

Related

Client Related

      OnPedBusted
      OnPedChangeWeapon
      OnPedCrouch
        OnPedDead
  OnPedEnteredVehicle
      OnPedEnteringVehicle
      OnPedEnterVehicle
  OnPedExitedVehicle
      OnPedExitingVehicle
      OnPedExitVehicle
      OnPedFall
      OnPedFireProjectile
      OnPedInflictDamage
      OnPedJump
        OnPedSpawn
  OnPedStartClosingVehicleDoor
      OnPedStartFightAttack
      OnPedStartFightDefend
  OnPedStartOpeningVehicleDoor
      OnPedUncrouch
      OnPedUseWeapon
        OnPedWasted