getVehicleTurretPosition | Multi Theft Auto: Wiki Skip to content

getVehicleTurretPosition

Client-side
Server-side
Shared

Pair: setVehicleTurretPosition

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 gets the position of a vehicle's turret, if it has one. Vehicles with turrets include firetrucks and tanks.

Syntax

getVehicleTurretPosition ( )

Code Examples

server
-- 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
-- Get the vehicle's turret position
local x, y = getVehicleTurretPosition ( vehicleValue )
-- Convert the positions to degrees, as that's much more useful if you'd want to output it
x = math.deg ( x )
y = math.deg ( y )
-- Get the vehicle's name
local vehicleName = getVehicleName ( vehicleValue )
-- Tell everyone in the F8 console the turret's position
outputConsole ( vehicleName .. "'s turret rotation: " .. x .. ", " .. y .. "." )
end

See Also

Vehicle Functions