GetCameraPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
float float float getCameraPosition ( player thePlayer )
float float float getCameraPosition ( )
</syntaxhighlight>  
</syntaxhighlight>  
===Required Arguments===
*'''thePlayer:''' The player whose camera position you wish to obtain.


===Returns===
===Returns===
Line 14: Line 11:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentence -->
This page lacks an example.
This example checks if the camera is fixed, and prints its position if so.
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function checkCamera( source )
--Add an example here
      if ( getCameraMode( source ) == "fixed" ) then                    -- If the camera is fixed...
            local camx, camy, camz = getCameraPosition( source )        -- Get the cameras position
            outputConsole( camx .. " " .. camy .. " " .. camz, source ) -- And output it.
      else
            outputConsole( "The camera is not fixed", source )          -- If not, say so.
      end
end
addCommandHandler( "check", checkCamera )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Camera functions}}
{{Camera functions}}
[[Category:Needs_Example]]

Revision as of 20:18, 29 November 2007

This function returns the position the player's camera would have if the camera mode is fixed (see setCameraMode).

Syntax

float float float getCameraPosition ( )

Returns

Returns three floats containing the x, y and z coordinates if the function was successful, false otherwise.

Example

This page lacks an example.

--Add an example here

See Also