GetVehicleRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 15: Line 15:


  float [[GetVehicleRotation|GetVehicleRotationZ]] ( [[vehicle]] vehicle )
  float [[GetVehicleRotation|GetVehicleRotationZ]] ( [[vehicle]] vehicle )
 
{{UsingRadians}}
===Required Arguments===
===Required Arguments===
*'''vehicle''': The [[vehicle]] whose rotation you want to retrieve.
*'''vehicle''': The [[vehicle]] whose rotation you want to retrieve.

Revision as of 07:50, 28 March 2006

Description

This function returns three floats containing the rotational position of the vehicle along the X, Y, and Z axes respectively. This function can fail if the player is not in a car. If this function does fail, the first argument will be set to 'false'.

The values of rotation must lie between 0 and 360 degrees.

Syntax

float float float GetVehicleRotation ( vehicle vehicle )

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

float GetVehicleRotationX ( vehicle vehicle )
float GetVehicleRotationY ( vehicle vehicle )
float GetVehicleRotationZ ( vehicle vehicle )

Template:UsingRadians

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