SetPedCameraRotation: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Needs example)
Line 16: Line 16:
Returns ''true'' if the camera rotation was changed, ''false'' otherwise.
Returns ''true'' if the camera rotation was changed, ''false'' otherwise.


==Example==  
==Example==
<syntaxhighlight lang="lua">--TODO</syntaxhighlight>
 
The next code snippet adds a command called /rotatecam, which rotates the camera of the player who uses it.
<syntaxhighlight lang="lua">
function rotateLocalPlayerCamera()
    setPedCameraRotation(localPlayer, getPedCameraRotation(localPlayer) + 45)
    outputChatBox("Your camera was rotated 45 degrees counter clockwise.", 0, 255, 0)
end
addCommandHandler("rotatecam", rotateLocalPlayerCamera)
</syntaxhighlight>


==See Also==
==See Also==
{{Client ped functions}}
{{Client ped functions}}

Revision as of 12:59, 17 May 2014

Accessories-text-editor.png Script Example Missing Function SetPedCameraRotation needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.


This function sets the camera rotation of a ped.

Syntax

bool setPedCameraRotation ( ped thePed, float cameraRotation )

Required Arguments

  • thePed: The ped whose camera rotation is to be changed
  • cameraRotation: The new direction that the ped will walk if you set their forwards control state

Returns

Returns true if the camera rotation was changed, false otherwise.

Example

The next code snippet adds a command called /rotatecam, which rotates the camera of the player who uses it.

function rotateLocalPlayerCamera()
    setPedCameraRotation(localPlayer, getPedCameraRotation(localPlayer) + 45)
    outputChatBox("Your camera was rotated 45 degrees counter clockwise.", 0, 255, 0)
end
addCommandHandler("rotatecam", rotateLocalPlayerCamera)

See Also