GetPedRotation: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
| Line 26: | Line 26: | ||
local playerVehicle = getPedOccupiedVehicle ( sourcePlayer ) | local playerVehicle = getPedOccupiedVehicle ( sourcePlayer ) | ||
-- and output its rotation | -- and output its rotation | ||
local x,y,z = | local x,y,z = getVehicleRotation ( playerVehicle ) | ||
outputChatBox ( "Your vehicle's rotation is: " .. z, sourcePlayer ) | z = (360-z) | ||
outputChatBox("Your vehicle's rotation is: "..tostring(z), sourcePlayer) | |||
-- if he is on foot | -- if he is on foot | ||
else | else | ||
-- output the player's rotation | -- output the player's rotation | ||
outputChatBox ( "Your rotation is: " .. getPedRotation ( sourcePlayer ), sourcePlayer ) | outputChatBox("Your rotation is: "..getPedRotation(sourcePlayer)), sourcePlayer) | ||
end | end | ||
end | end | ||
Revision as of 19:26, 29 January 2010
Gets the rotation of a ped.
Syntax
float getPedRotation ( ped thePed )
Required Arguments
- thePed: the ped to retrieve the rotation of.
Returns
Returns the rotation of the ped, in degrees: 0 means facing north, higher values go counter clockwise. Returns false if an invalid element was passed.
Example
Click to collapse [-]
ServerThis code adds a getrot command to get a player's current rotation.
function outputPlayerRotation ( sourcePlayer )
-- if the command was triggered by an ingame player
if ( sourcePlayer ) then
-- if he is in a vehicle
if isPedInVehicle ( sourcePlayer ) then
-- store the vehicle element
local playerVehicle = getPedOccupiedVehicle ( sourcePlayer )
-- and output its rotation
local x,y,z = getVehicleRotation ( playerVehicle )
z = (360-z)
outputChatBox("Your vehicle's rotation is: "..tostring(z), sourcePlayer)
-- if he is on foot
else
-- output the player's rotation
outputChatBox("Your rotation is: "..getPedRotation(sourcePlayer)), sourcePlayer)
end
end
end
-- register outputPlayerRotation as a handler for the getrot command
addCommandHandler ( "getrot", outputPlayerRotation )
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
- isPedOnGround
- isPedReloadingWeapon
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle