OnClientVehicleWeaponHit: Difference between revisions
Jump to navigation
Jump to search
Fernando187 (talk | contribs) m (→Parameters) |
|||
(5 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3.0157|1.5.6|16074| | {{New feature/item|3.0157|1.5.6|16074| | ||
This event is called when a vehicle weapon hits an element. | This event is called when a vehicle weapon hits an element or the world. | ||
}} | }} | ||
{{Note|This event is only triggered for elements that are streamed in}} | {{Note|This event is only triggered for elements that are streamed in}} | ||
{{Note|Weapon Types: | |||
*'''0''': Invalid | |||
*'''1''': Water Canon | |||
*'''2''': Tank Gun - Not yet implemented. | |||
*'''3''': Rocket - Not yet implemented. | |||
*'''4''': Heat Seeking Rocket - Not yet implemented.}} | |||
==Parameters== | ==Parameters== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int weaponType, element hitElement, float hitX, float hitY, float hitZ, int model, int materialID | 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 | *'''weaponType''': The type of vehicle weapon. (See the list above) | ||
*'''hitElement''': The [[vehicle]], [[ped]] or [[player]] that was hit by the weapon sometimes ''false''. | *'''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. | *'''hitX''': The X world co-ordinate of where the hit occured. | ||
Line 16: | Line 22: | ||
*'''model''': The model ID of the element that was hit. | *'''model''': The model ID of the element that was hit. | ||
*'''materialID''': The material ID of the element that was hit. | *'''materialID''': The material ID of the element that was hit. | ||
==Source== | ==Source== | ||
The [[event system#Event source|source]] of this event is the [[vehicle]] that fired the weapon. | The [[event system#Event source|source]] of this event is the [[vehicle]] that fired the weapon. | ||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler("onClientVehicleWeaponHit", root, | addEventHandler("onClientVehicleWeaponHit", root, | ||
Line 39: | Line 35: | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== |
Latest revision as of 17:58, 1 June 2025
This event is called when a vehicle weapon hits an element or the world.
Parameters
int weaponType, element hitElement, float hitX, float hitY, float hitZ, int model, int materialID
- weaponType: The type of vehicle weapon. (See the list above)
- 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.
Source
The source of this event is the vehicle that fired the weapon.
Example
Click to collapse [-]
ClientaddEventHandler("onClientVehicleWeaponHit", root, function(weaponType, hitElement, hitX, hitY, hitZ, model, materialID) outputChatBox(tostring(weaponType).." "..tostring(hitElement).." "..tostring(hitX).." "..tostring(hitY).." "..tostring(hitZ).." "..tostring(model).." "..tostring(materialID)) end )
See Also
Client vehicle events
- onClientTrailerAttach
- onClientTrailerDetach
- onClientVehicleCollision
- onClientVehicleDamage
- onClientVehicleEnter
- onClientVehicleExit
- onClientVehicleExplode
- onClientVehicleNitroStateChange
- onClientVehicleRespawn
- onClientVehicleStartEnter
- onClientVehicleStartExit
- onClientVehicleWeaponHit
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled