GetVehicleTurretPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
Line 6: Line 6:
  float float [[GetVehicleTurretPosition]] ( [[vehicle]] vehicle )
  float float [[GetVehicleTurretPosition]] ( [[vehicle]] vehicle )


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


  float [[GetVehicleTurretPosition|GetVehicleTurretPositionX]] ( [[vehicle]] vehicle )
  float [[GetVehicleTurretPosition|GetVehicleTurretPositionX]] ( [[vehicle]] vehicle )


  float [[GetVehicleTurretPosition|GetVehicleTurretPositionY]] ( [[vehicle]] vehicle )
  float [[GetVehicleTurretPosition|GetVehicleTurretPositionY]] ( [[vehicle]] vehicle )
float [[GetVehicleTurretPosition|GetVehicleTurretPositionZ]] ( [[vehicle]] vehicle )


===Required Arguments===
===Required Arguments===

Revision as of 07:40, 28 March 2006

Description

This function returns two floats containing the rotational position of the vehicle's turret along the horizontal and vertical axes (X and Y) respectively. This function can fail if the player is not in a vehicle, or if the vehicle does not have a turret. Vehicles with turrets include tanks and fire trucks. If this function does fail, the first argument will be set to 'false'.

Syntax

float float GetVehicleTurretPosition ( vehicle vehicle )

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

float GetVehicleTurretPositionX ( vehicle vehicle )
float GetVehicleTurretPositionY ( vehicle vehicle )

Required Arguments

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

Example

newcar = createVehicle ( 520, 1024, 1024, 1024 )
x, y = GetVehicleTurretPosition ( newcar )

if (x)
 serverchat ( "Turret position: ",x,",",y,"." )
end