SetPedRotation: Difference between revisions
Jump to navigation
Jump to search
m (deprecated) |
No edit summary |
||
Line 6: | Line 6: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setPedRotation ( ped thePed, float rotation ) | bool setPedRotation ( ped thePed, float rotation [, bool conformPedAirRotation = false ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 12: | Line 12: | ||
*'''thePed:''' The [[ped]] to set the rotation of | *'''thePed:''' The [[ped]] to set the rotation of | ||
*'''rotation:''' A [[float]] specifying the desired rotation in degrees. | *'''rotation:''' A [[float]] specifying the desired rotation in degrees. | ||
===Optional Arguments=== | |||
{{New feature/item|3.0152|1.3.2|4680| | |||
*'''conformPedAirRotation:''' A bool which should be set to ''true'' to ensure the ped rotation is correctly set in all circumstances. Failing to set this argument may result in the rotation being inverted when the ped is in the air. The default value of false is for backward compatibility with scripts which may depend upon the incorrect behaviour | |||
}} | |||
===Returns=== | ===Returns=== | ||
Line 32: | Line 37: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
==Changelog== | |||
{{ChangelogHeader}} | |||
{{ChangelogItem|1.3.1-9.04680|Added conformPedAirRotation argument}} | |||
==See Also== | ==See Also== | ||
{{Ped_functions}} | {{Ped_functions}} | ||
[[ru:setPedRotation]] | [[ru:setPedRotation]] |
Revision as of 06:17, 17 September 2012
This function allows you to set the current rotation of the specified ped.
Syntax
bool setPedRotation ( ped thePed, float rotation [, bool conformPedAirRotation = false ] )
Required Arguments
- thePed: The ped to set the rotation of
- rotation: A float specifying the desired rotation in degrees.
Optional Arguments
- conformPedAirRotation: A bool which should be set to true to ensure the ped rotation is correctly set in all circumstances. Failing to set this argument may result in the rotation being inverted when the ped is in the air. The default value of false is for backward compatibility with scripts which may depend upon the incorrect behaviour
Returns
Returns true if successful, false otherwise.
Example
Click to collapse [-]
ClientThis example allows a player to type the command 'disco', which will result in the player being rotated to a random direction every 1 second, infinite times.
function discoTime ( ) -- Randomly choose a new player rotation and set it newRotation = math.random ( 0, 360 ) setPedRotation ( getLocalPlayer(), newRotation ) end function initiateDiscoMode ( commandName ) -- Trigger a random change in player rotation every second setTimer ( discoTime, 1000, 0 ) end addCommandHandler ( "disco", initiateDiscoMode )
Changelog
Version | Description |
---|
1.3.1-9.04680 | Added conformPedAirRotation argument |
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