Difference between revisions of "OnClientVehicleWeaponHit"

From Multi Theft Auto: Wiki
(Created page with "{{Client event}} __NOTOC__ {{New feature/item|3.0157|1.5.6|16074| This event is called when a vehicle weapon hits an element. }} {{Note|This event is only triggered for elemen...")
 
Line 7: Line 7:
 
==Parameters==
 
==Parameters==
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
  bool leftFoot
+
  int weaponType, element hitElement, float hitX, float hitY, float hitZ, int model, int materialID
 
</syntaxhighlight>  
 
</syntaxhighlight>  
 
*'''weaponType''': The type of vehicle weapon. (See the list below)
 
*'''weaponType''': The type of vehicle weapon. (See the list below)

Revision as of 21:43, 5 December 2018

This event is called when a vehicle weapon hits an element.

[[{{{image}}}|link=]] Note: This event is only triggered for elements that are streamed in

Parameters

 int weaponType, element hitElement, float hitX, float hitY, float hitZ, int model, int materialID
  • weaponType: The type of vehicle weapon. (See the list below)
  • hitElement: The vehicle, ped or player that was hit by the weapon sometimes false.
  • hitX: The X world co-ordinate of where the hit occured.
  • hitY: The Y world co-ordinate of where the hit occured.
  • hitZ: The Z world co-ordinate of where the hit occured.
  • model: The model ID of the element that was hit.
  • materialID: The material ID of the element that was hit.

Weapon types

  • 0: Invalid
  • 1: Water Canon
  • 2: Tank Gun - Doesn't seem to trigger for Rhino.
  • 3: Rocket - Doesn't seem to trigger with Hydra or Hunter.
  • 4: Heat Seeking Rocket - Doesn't seem to trigger with Hydra.

Source

The source of this event is the vehicle that fired the weapon.

Requirements

Minimum supported server n/a
Minimum supported client 1.5.6.16074

Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.6.16074" />

Example

addEventHandler("onClientVehicleWeaponHit", root,
     function(weaponType, hitElement, hitX, hitY, hitZ, model, materialID)
          outputChatBox(tostring(weaponType).." "..tostring(hitElement).." "..tostring(hitX)
     end
)

</section>

See Also

Client vehicle events


Client event functions