OnPedInflictDamage: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{ScriptItem
{{ScriptItem2
|endpoint = client
|name = onPedInflictDamage
|side = client
|type = event
|type = event
|name = onPedInflictDamage
|games = iii vc sa iv
|usage = a ped is damaged
|desc = a ped is damaged
|callbackParameters = Event event, Ped ped, Entity responsibleEntity, int weapon, float loss, int pedPiece
|arg1 = Ped ped The ped that has been damaged.
|parameter1 = Ped ped The ped that has been damaged.
|arg2 = Entity responsibleEntity The entity that is responsible for the damage.
|parameter2 = Entity responsibleEntity The entity that is responsible for the damage.
|arg3 = int weapon The weapon ID for the damage.
|parameter3 = int weapon The weapon ID for the damage.
|arg4 = float loss The ped health lost for the damage.
|parameter4 = float loss The ped health lost for the damage.
|arg5 = int pedPiece The ped piece ID for the damage.
|parameter5 = int pedPiece The ped piece ID for the damage.
|cancel = true
|cancellable = true
|exampleJSCS = addEventHandler('onPedInflictDamage', function(event, ped, responsibleEntity, weapon, loss, pedPiece)
|exampleJSCS = addEventHandler('onPedInflictDamage', function(event, ped, responsibleEntity, weapon, loss, pedPiece)
{
{

Revision as of 20:28, 19 November 2022

Event Client Only icon-iii.png icon-vc.png icon-sa.png icon-iv.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

icon-iii.png icon-vc.png icon-sa.png OnPedBusted
icon-iii.png icon-vc.png icon-sa.png OnPedChangeWeapon
icon-iii.png icon-vc.png icon-sa.png OnPedCrouch
icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnPedDead
icon-vc.png OnPedEnteredVehicle
icon-iii.png icon-vc.png icon-sa.png OnPedEnteringVehicle
icon-iii.png icon-vc.png icon-sa.png OnPedEnterVehicle
icon-vc.png OnPedExitedVehicle
icon-iii.png icon-vc.png icon-sa.png OnPedExitingVehicle
icon-iii.png icon-vc.png icon-sa.png OnPedExitVehicle
icon-iii.png icon-vc.png icon-sa.png OnPedFall
icon-iii.png icon-vc.png icon-sa.png OnPedFireProjectile
icon-iii.png icon-vc.png icon-sa.png OnPedInflictDamage
icon-iii.png icon-vc.png icon-sa.png OnPedJump
icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnPedSpawn
icon-vc.png OnPedStartClosingVehicleDoor
icon-iii.png icon-vc.png icon-sa.png OnPedStartFightAttack
icon-iii.png icon-vc.png icon-sa.png OnPedStartFightDefend
icon-vc.png OnPedStartOpeningVehicleDoor
icon-iii.png icon-vc.png icon-sa.png OnPedUncrouch
icon-iii.png icon-vc.png icon-sa.png OnPedUseWeapon
icon-iii.png icon-vc.png icon-sa.png icon-iv.png OnPedWasted