GetVehicleRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


==Syntax==
==Syntax==
float float float [[GetVehicleRotation]] ( [[vehicle]] vehicle )
<syntaxhighlight lang="lua">GetVehicleRotation ( vehicle )</syntaxhighlight>


This function also has three variants that allow you to retrieve data from just one of the three axis.
This function also has three variants that allow you to retrieve data from just one of the three axis.


float [[GetVehicleRotation|GetVehicleRotationX]] ( [[vehicle]] vehicle )
<syntaxhighlight lang="lua">GetVehicleRotation|GetVehicleRotationX ( vehicle )</syntaxhighlight>


float [[GetVehicleRotation|GetVehicleRotationY]] ( [[vehicle]] vehicle )
<syntaxhighlight lang="lua">GetVehicleRotation|GetVehicleRotationY ( vehicle )</syntaxhighlight>


float [[GetVehicleRotation|GetVehicleRotationZ]] ( [[vehicle]] vehicle )
<syntaxhighlight lang="lua">GetVehicleRotation|GetVehicleRotationZ ( vehicle )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''vehicle''': The [[vehicle]] whose rotation you want to retrieve.
*'''vehicle''': The vehicle whose rotation you want to retrieve.


==Example==
==Example==
 
<syntaxhighlight lang="lua">newcar = createVehicle ( 520, 1024, 1024, 1024 )
newcar = [[createVehicle]] ( 520, 1024, 1024, 1024 )
x, y, z = GetVehicleRotation ( newcar )
x, y, z = [[GetVehicleRotation]] ( newcar )
if (x)
serverChat ( "Current rotation: ", x, " ," ,y ," ," ,z , "." )
if (x)
end</syntaxhighlight>
  [[serverChat]] ( "Current rotation: ", x, " ," ,y ," ," ,z , "." )
end

Revision as of 03:06, 18 May 2006

Description

This function returns three floats containing the rotational position of the vehicle along the X, Y, and Z axes respectively as degrees. If this function does fail, it will return 'false'.

Syntax

GetVehicleRotation ( vehicle )

This function also has three variants that allow you to retrieve data from just one of the three axis.

GetVehicleRotation|GetVehicleRotationX ( vehicle )
GetVehicleRotation|GetVehicleRotationY ( vehicle )
GetVehicleRotation|GetVehicleRotationZ ( vehicle )

Required Arguments

  • vehicle: The vehicle whose rotation you want to retrieve.

Example

newcar = createVehicle ( 520, 1024, 1024, 1024 )
x, y, z = GetVehicleRotation ( newcar )
if (x)
 serverChat ( "Current rotation: ", x, " ," ,y ," ," ,z , "." )
end