M MY Multiplayer: Wiki
Side
Kind

setElementVelocity

Shared

Sets an element's velocity.

bool setElementVelocity(element element, float x, y, z)

Parameters

NameTypeDescription
elementelementThe ped, player, vehicle or object.
x, y, zfloatVelocity 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)

See also