OutgoingDamage

From RAGE Multiplayer Wiki
Revision as of 20:07, 13 May 2021 by Phill (talk | contribs) (removed statement without registered bool)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side Event

 C#  JavaScript


Triggered upon damage that an entity is about to give another entity.

This event is also cancellable.

JavaScript Syntax

Parameters

  • sourceEntity: Object
  • targetEntity: Object
  • sourcePlayer: Object
  • weapon: Int
  • boneIndex: Int
  • damage: Int

Example

Client-Side
mp.events.add('outgoingDamage', (sourceEntity, targetEntity, sourcePlayer, weapon, boneIndex, damage) => {
    if (targetEntity.type === 'player' && boneIndex === 20) {
        return true; // disable outgoing headshot damage
    }
});


C# Syntax

Parameters

  • sourceEntity: Entity - entity who received the damage.
  • targetEntity: Entity - entity who dealt the damage.
  • sourcePlayer: Player - player who received the damage.
  • weapon: UInt64 - weapon which did the damage.
  • boneIndex: UInt64 - hit BoneIndex (not the BoneId!)
  • damage: Int - damage it will deal (if not canceled)
  • cancel: CancelEventArgs - cancel to disable the damage.

Example

Client-Side
public MyClass() 
{
    OnOutgoingDamage += OnOutgoingDamageHandler;
}

private void OnOutgoingDamageHandler(Entity sourceEntity, Entity targetEntity, Player sourcePlayer, ulong weaponHash, ulong boneIdx, int damage, CancelEventArgs cancel)
{
    // Disable outgoing headshot damage
    if (target.Type == EntityType.Player && boneIdx.Equals(20)) 
    {
        cancel.Cancel = true;
        return;
    }
}


See Also

Browser

Checkpoints

Colshapes

Console

Common

Damage

Vehicles

Voice chat

Streaming

Graphics

Waypoint

Misc