GetPedCameraRotation: Difference between revisions
Jump to navigation
Jump to search
UniOnDennis (talk | contribs) |
(Added a little more documentation) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{client function}} | {{client function}} | ||
{{Note|The camera rotation angle returned by this function is 360º - α (where α is the actual camera rotation angle). See example to know how to deal with this.}} | |||
This function gets the current camera rotation of a [[ped]]. | |||
==Syntax== | ==Syntax== | ||
Line 9: | Line 10: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePed:''' the ped to retrieve the camera rotation of. | *'''thePed:''' the [[ped]] to retrieve the camera rotation of. | ||
===Returns=== | ===Returns=== | ||
Returns the camera rotation of the ped | Returns the camera rotation of the [[ped]] in degrees if successful. Returns ''false'' if an invalid element was passed. | ||
==Example== | ==Example== | ||
This example creates a '''/getrotation''' command which outputs the expected camera rotation of the player which types it. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler( "getrotation", | addCommandHandler( "getrotation", | ||
function () | function () | ||
local | local rot = 360 - getPedCameraRotation(localPlayer) -- Also fix the camera rotation | ||
outputChatBox( "Your camera rotation is | outputChatBox("Your camera rotation is " .. rotation .. "º", 0, 225 0) | ||
end | end | ||
) | ) |
Revision as of 20:00, 28 October 2014
This function gets the current camera rotation of a ped.
Syntax
float getPedCameraRotation( ped thePed )
Required Arguments
- thePed: the ped to retrieve the camera rotation of.
Returns
Returns the camera rotation of the ped in degrees if successful. Returns false if an invalid element was passed.
Example
This example creates a /getrotation command which outputs the expected camera rotation of the player which types it.
addCommandHandler( "getrotation", function () local rot = 360 - getPedCameraRotation(localPlayer) -- Also fix the camera rotation outputChatBox("Your camera rotation is " .. rotation .. "º", 0, 225 0) end )
See Also
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle