GetCameraMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(9 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__
This function returns a [[string]] containing the current mode of the specified player's camera.
{{Server function}}
{{Deprecated|getCameraTarget|}}
 
This function returns a [[string]] containing the current mode of the player's camera.
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 8: Line 11:
===Required Arguments===  
===Required Arguments===  
*'''thePlayer:''' The player whose camera mode you wish to obtain.
*'''thePlayer:''' The player whose camera mode you wish to obtain.


===Returns===
===Returns===
Line 17: Line 21:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This function checks the camera state of a player, by specifying his name:
This function checks the camera state of a player.
<!-- 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">
addCommandHanler( "camera", "checkCamera" )
function checkCamera( source, command, targetName )
function checkCamera( source, command, player )
       local targetPlayer = getPlayerFromNick ( targetName )   -- Get the player using his name
       player = getPlayerFromName( player ) --Gets the player using his name
       outputConsole( targetName.."'s camera mode is: "..getCameraMode( targetPlayer ), source ) -- Output the state of player's camera
       outputConsole( getCameraMode( player ), source ) --Outputs the state of players' camera.
end
end
addCommandHandler( "camera", checkCamera )
</syntaxhighlight>
</syntaxhighlight>


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

Latest revision as of 16:24, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getCameraTarget instead.


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