GetPedCameraRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 15: Line 15:


==Example==
==Example==
<section name="Client" class="Client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Todo
-- Create a command that outputs the camera rotation of the localPlayer
addCommandHandler( "getrotation",
    function ()
        local rotation = getPedCameraRotation( localPlayer )
        outputChatBox( "Your camera rotation is: "..rotation, 0, 225 0 )
    end
)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Ped functions}}
{{Ped functions}}

Revision as of 23:55, 30 January 2013

Gets the 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: 0 means facing north, higher values go counter clockwise. Returns false if an invalid element was passed.

Example

-- Create a command that outputs the camera rotation of the localPlayer
addCommandHandler( "getrotation", 
    function ()
        local rotation = getPedCameraRotation( localPlayer )
        outputChatBox( "Your camera rotation is: "..rotation, 0, 225 0 )
    end
)

See Also

Shared