GetVehicleTurretPosition: Difference between revisions
Jump to navigation
Jump to search
(Removed reference to variants, removed Using Radians template) |
|||
Line 1: | Line 1: | ||
__NOTOC__ | |||
{{Server client function}} | {{Server client function}} | ||
{{Needs Checking|if the vehicle has no turret it returns 0, 0 not ''false''as the desciption says --[[User:Norby89|Norby89]] 10:05, 18 August 2007 (CDT)}} | {{Needs Checking|if the vehicle has no turret it returns 0, 0 not ''false''as the desciption says --[[User:Norby89|Norby89]] 10:05, 18 August 2007 (CDT)}} | ||
{{Needs Checking|"Returns" section info is wrong, this function doesn't retrieve rotation. The example could be improved.}} | |||
This function gets the position of a vehicle's turret, if it has one. Vehicles with turrets include firetrucks and tanks. | This function gets the position of a vehicle's turret, if it has one. Vehicles with turrets include firetrucks and tanks. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">float float getVehicleTurretPosition ( vehicle turretVehicle )</syntaxhighlight> | <syntaxhighlight lang="lua">float, float getVehicleTurretPosition ( vehicle turretVehicle )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''turretVehicle''': The [[vehicle]] whose | *'''turretVehicle''': The [[vehicle]] whose turret position you want to retrieve. This should be a vehicle with a turret. | ||
===Returns=== | ===Returns=== | ||
Returns two [[float]]s for the X (horizontal) and Y (vertical) axis rotation respectively. These values are in radians. The function will return ''false'' | Returns two [[float]]s for the X (horizontal) and Y (vertical) axis rotation respectively. These values are in radians. The function will return ''false'' if the vehicle is not a vehicle with a turret. | ||
==Example== | ==Example== |
Revision as of 13:04, 23 August 2007
This article needs checking. | |
Reason(s): if the vehicle has no turret it returns 0, 0 not falseas the desciption says --Norby89 10:05, 18 August 2007 (CDT) |
This article needs checking. | |
Reason(s): "Returns" section info is wrong, this function doesn't retrieve rotation. The example could be improved. |
This function gets the position of a vehicle's turret, if it has one. Vehicles with turrets include firetrucks and tanks.
Syntax
float, float getVehicleTurretPosition ( vehicle turretVehicle )
Required Arguments
- turretVehicle: The vehicle whose turret position you want to retrieve. This should be a vehicle with a turret.
Returns
Returns two floats for the X (horizontal) and Y (vertical) axis rotation respectively. These values are in radians. The function will return false if the vehicle is not a vehicle with a turret.
Example
-- 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 ) -- If the vehicle has a turret (the function will return false if it doesn't) then if ( x ~= false ) then -- Tell everyone in the chat the turret's position outputChatBox ( "Turret position: " .. x .. ", " .. y .. "." ) end end
See Also
- addVehicleUpgrade
- attachTrailerToVehicle
- blowVehicle
- createVehicle
- detachTrailerFromVehicle
- fixVehicle
- getOriginalHandling
- getTrainDirection
- getTrainPosition
- getTrainSpeed
- getTrainTrack
- getVehicleColor
- getVehicleCompatibleUpgrades
- getVehicleController
- getVehicleDoorOpenRatio
- getVehicleDoorState
- getVehicleEngineState
- getVehicleHandling
- getVehicleHeadLightColor
- getVehicleLandingGearDown
- getVehicleLightState
- getVehicleMaxPassengers
- getVehicleModelFromName
- getVehicleName
- getVehicleNameFromModel
- getVehicleOccupant
- getVehicleOccupants
- getVehicleOverrideLights
- getVehiclePaintjob
- getVehiclePanelState
- getVehiclePlateText
- getVehicleSirenParams
- getVehicleSirens
- getVehicleSirensOn
- getVehicleTowedByVehicle
- getVehicleTowingVehicle
- getVehicleTurretPosition
- getVehicleType
- getVehicleUpgradeOnSlot
- getVehicleUpgradeSlotName
- getVehicleUpgrades
- getVehicleVariant
- getVehicleWheelStates
- isTrainDerailable
- isTrainDerailed
- isVehicleBlown
- isVehicleDamageProof
- isVehicleFuelTankExplodable
- isVehicleLocked
- isVehicleOnGround
- isVehicleTaxiLightOn
- removeVehicleUpgrade
- setTrainDerailable
- setTrainDerailed
- setTrainDirection
- setTrainPosition
- setTrainSpeed
- setTrainTrack
- setVehicleColor
- setVehicleDamageProof
- setVehicleDoorOpenRatio
- setVehicleDoorState
- setVehicleDoorsUndamageable
- setVehicleEngineState
- setVehicleFuelTankExplodable
- setVehicleHandling
- setVehicleHeadLightColor
- setVehicleLandingGearDown
- setVehicleLightState
- setVehicleLocked
- setVehicleOverrideLights
- setVehiclePaintjob
- setVehiclePanelState
- setVehiclePlateText
- setVehicleSirens
- setVehicleSirensOn
- setVehicleTaxiLightOn
- setVehicleTurretPosition
- setVehicleVariant
- setVehicleWheelStates