OnVehicleDamage

From Onset Developer Wiki
OnVehicleDamage

Type: Event
Context: Server
Introduced: v1.1.0

Description

This event is called when a vehicles takes health damage or physical damage.

Syntax

OnVehicleDamage(vehicle, healthDamage [, damageIndex, damageAmount])

Parameters

  • vehicle
    The vehicle identifier.
  • healthDamage
    The amount of health damage.
  • damageIndex (optional)
    The physical damage index (part of the vehicle).
  • damageAmount (optional)
    The amount of physical damage.

Example

AddEvent("OnVehicleDamage", function(vehicle, healthDamage, damageIndex, damageAmount)
    if GetVehicleDriver(vehicle) > 0 then
        AddPlayerChat(GetVehicleDriver(vehicle), "You have damaged the vehicle.")
    end
end)

See also