OnVehicleDamage

From Onset Developer Wiki
Revision as of 17:01, 8 March 2020 by BlueMountains (talk | contribs) (Created page with "{{Info|Event|Server & Client|1.0}} {{FuncDescription|This event is called when a vehicles takes health damage or physical damage.}} {{FuncSyntax|OnVehicleDamage(vehicle, hea...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
OnVehicleDamage

Type: Event
Context: Server & Client
Introduced: v1.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