GetCameraMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(fixed the examples)
No edit summary
Line 1: Line 1:
{{Server client function}}
{{deprecated}}
{{Server function}}
__NOTOC__
__NOTOC__
This function returns a [[string]] containing the current mode of the player's camera.
This function returns a [[string]] containing the current mode of the player's camera.
==Syntax==  
==Syntax==  
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getCameraMode ( player thePlayer )
string getCameraMode ( player thePlayer )
Line 10: Line 10:
===Required Arguments===  
===Required Arguments===  
*'''thePlayer:''' The player whose camera mode you wish to obtain.
*'''thePlayer:''' The player whose camera mode you wish to obtain.
</section>


<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
string getCameraMode ( )
</syntaxhighlight>
===Required Arguments===
''None.''
</section>


===Returns===
===Returns===
Line 29: Line 20:


==Example==  
==Example==  
<section name="Server script" class="server" show="true">
This function checks the camera state of a player, by specifying his name:
This function checks the camera state of a player, by specifying his name:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 38: Line 28:
addCommandHandler( "camera", checkCamera )
addCommandHandler( "camera", checkCamera )
</syntaxhighlight>
</syntaxhighlight>
</section>
<section name="Client script" class="client" show="false">
This function checks the camera state of the local player:
<syntaxhighlight lang="lua">
function checkCamera( command )
      outputConsole( "The current camera mode is: "..getCameraMode() )  -- Output the state of player's camera
end
addCommandHandler( "camera", checkCamera )
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Camera functions}}
{{Camera functions}}

Revision as of 15:34, 29 January 2009

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions, but there should be a more generic way to perform what it does.

This function returns a string containing the current mode of the player's camera.

Syntax

string getCameraMode ( player thePlayer )

Required Arguments

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


Returns

Returns a string with one of two values if successful:

  • player: The camera is attached to a player.
  • fixed: The camera is in a fixed position.

The function will return false if unsuccessful.

Example

This function checks the camera state of a player, by specifying his name:

function checkCamera( source, command, targetName )
      local targetPlayer = getPlayerFromNick ( targetName )   -- Get the player using his name
      outputConsole( targetName.."'s camera mode is: "..getCameraMode( targetPlayer ), source )  -- Output the state of player's camera
end
addCommandHandler( "camera", checkCamera )

See Also