- Documentation
- Shared functions
- setElementSpeed
Function
setElementSpeed
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)