setVehicleTurretPosition | Multi Theft Auto: Wiki Skip to content

setVehicleTurretPosition

Client-side
Server-side
Shared

Pair: getVehicleTurretPosition

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function sets the position of a vehicle's turret, if it has one. This can be used to influence the turret's rotation, so it doesn't follow the camera. Vehicles with turrets include firetrucks and tanks.

Syntax

setVehicleTurretPosition ( )

Code Examples

server

This example will force vehicle turrets to aim straight forwards.

-- Find all the vehicles, and store them in a vehicles variable
local vehicles = getElementsByType ( "vehicle" )
-- Loop through the vehicle list
for vehicleKey, vehicleValue in ipairs(vehicles) do
-- Set the turret to aim straight forwards
setVehicleTurretPosition ( vehicleValue, 0, 0 )
end

See Also

Vehicle Functions