OnVehicleDamage: Difference between revisions

From Onset Developer Wiki
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..."
 
No edit summary
 
Line 1: Line 1:
{{Info|Event|Server & Client|1.0}}
{{Info|Event|Server|1.1.0}}


{{FuncDescription|This event is called when a vehicles takes health damage or physical damage.}}
{{FuncDescription|This event is called when a vehicles takes health damage or physical damage.}}

Latest revision as of 17:01, 8 March 2020

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