ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. setElementSpeed

Function

setElementSpeed

Server and clientElementsTrilogy Hub only

Sets the speed of an element while keeping its direction of travel. If the element is standing still, it is pushed forward.

Syntax

bool setElementSpeed(element element, float speed [, string unit = "kmh"])

Arguments

elementelement
A vehicle, ped or object.
speedfloat
The new speed.
unitstring, optional = "kmh"
Unit: "kmh", "mph" or "ms".

Returns

true on success.

Example

addCommandHandler("turbo", function(player)
    local veh = getPedOccupiedVehicle(player)
    if veh then setElementSpeed(veh, 150) end
end)

See also