GetCameraPosition: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 22: Line 22:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example does...
<!-- 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">
addCommandHandler( "check", "checkCamera" )
function checkCamera( source )
      if ( getCameraMode( source ) == "fixed" ) then
            local camx, camy, camz = getCameraPosition( source )
            outputConsole( camx .. " " .. camy .. " " .. camz, source )
      else
            outputConsole( "The camera is not fixed", source )
      end
</syntaxhighlight>


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

Revision as of 12:19, 19 April 2007

Dialog-information.png This article needs checking.

Reason(s): Returns 0 0 0 with script:
addCommandHandler ( "getcampos", "retrieveCameraPosition" )
function retrieveCameraPosition ( player, commandName )
local camx, camy, camz = getCameraPosition ( player )
outputChatBox ( "X: "..camx.." Y: "..camy.." Z: "..camz )
end
--Ransom 17:17, 11 April 2007 (CDT)



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

Syntax

float float float getCameraPosition ( player thePlayer )

Required Arguments

  • thePlayer: The player whose camera position you wish to obtain.

Returns

Returns three floats containing the x, y and z co-ordinate values if the function was successful, false otherwise.

Example

This example does...

addCommandHandler( "check", "checkCamera" )
function checkCamera( source )
      if ( getCameraMode( source ) == "fixed" ) then
            local camx, camy, camz = getCameraPosition( source )
            outputConsole( camx .. " " .. camy .. " " .. camz, source )
      else
            outputConsole( "The camera is not fixed", source )
      end

See Also