ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client events
  3. onClientVehicleCollision

Event

onClientVehicleCollision

ClientBrowserIdentical to MTA:SA

The vehicle this player drives hit something (a sudden change of speed, at least 2.5 m/s in one frame). Teleports and setElementVelocity from scripts do not count.

Handler

addEventHandler("onClientVehicleCollision", root, function(theHitElement, force, bodyPart, collisionX, collisionY, collisionZ, normalX, normalY, normalZ, hitElementForce, model) ... end)

Parameters

theHitElementelement
The element hit, or false (wall, ground, building).
forcefloat
Impact force: change of speed × mass / 50.
bodyPartint
Always 0.
collisionX, collisionY, collisionZfloat
Impact point.
normalX, normalY, normalZfloat
Surface normal.
hitElementForcefloat
Speed of the element hit (m/s).
modelint
Model of the element hit, or 0.

Source

source is the vehicle.

Example

addEventHandler("onClientVehicleCollision", root, function(hit, force)
    if force > 500 then playSoundFrontEnd(4) end
end)

See also