setElementVelocity
Shared
Sets an element's velocity.
bool setElementVelocity(element element, float x, y, z)
Parameters
| Name | Type | Description |
|---|---|---|
| element | element | The ped, player, vehicle or object. |
| x, y, z | float | Velocity along each axis, in units per simulation step. |
Returns
true if it was set, false if the element has no velocity.
Example
bindKey("space", "down", function()
local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
local velocity = getElementVelocity(vehicle)
setElementVelocity(vehicle, velocity.x, velocity.y, velocity.z + 0.3)
end
end)