GetCameraMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 39: Line 39:
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
<section name="Client script" class="client" show="false">
<syntaxhighlight lang="lua">
function checkCamera( command, targetName )
      local targetPlayer = getPlayerFromNick ( getLocalPlayer())  -- Get the player using his name
      outputConsole( getCameraMode(), getLocalPlayer())  -- Output the state of player's camera
end
addCommandHandler( "camera", checkCamera )
</syntaxhighlight>


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

Revision as of 08:50, 27 October 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 )

<section name="Client script" class="client" show="false">

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

See Also