GetCameraMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
{{Server function}}
{{Server client function}}
__NOTOC__
__NOTOC__
This function returns a [[string]] containing the current mode of the specified 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 9: 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 18: Line 29:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This function checks the camera state of a player:
This function checks the camera state of a player.
<section name="Server script" class="server" show="true">
<!-- 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, command, targetName )
function checkCamera( source, command, targetName )
Line 28: Line 38:
addCommandHandler( "camera", checkCamera )
addCommandHandler( "camera", checkCamera )
</syntaxhighlight>
</syntaxhighlight>
</section>


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

Revision as of 06:10, 16 March 2008

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

Syntax

Click to collapse [-]
Server
string getCameraMode ( player thePlayer )

Required Arguments

  • thePlayer: The player whose camera mode you wish to obtain.
Click to collapse [-]
Client
string getCameraMode ( )

Required Arguments

None.

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:

Click to collapse [-]
Server script
function checkCamera( source, command, targetName )
      local targetPlayer = getPlayerFromNick ( targetName )   -- Get the player using his name
      outputConsole( getCameraMode( targetPlayer ), source )  -- Output the state of player's camera
end
addCommandHandler( "camera", checkCamera )

See Also