SetCameraMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__
{{Server function}}
<h2 style="margin:0; background:#990000; font-size:120%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#fff; padding:0.2em 0.4em;">Please remember to set players camera mode back to "player" on resource unload, or you will encounter the invisible player 'bug' if players camera is still set to fixed</h2>
<h2 style="margin:0; background:#990000; font-size:120%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#fff; padding:0.2em 0.4em;">Please remember to set players camera mode back to "player" on resource unload, or you will encounter the invisible player 'bug' if players camera is still set to fixed</h2>


This function allows you to change a player's camera mode to either "player" or "fixed".  
This function allows you to set a player's camera to either follow him or be fixed at a certain position.


==Syntax==  
==Syntax==  
Line 21: Line 22:


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
 
function spawnScreen ( source )
function spawnScreen ( source ) --Calls the function spawnScreen
        setCameraMode ( source, "fixed" )                                     -- Make the camera fixed (instead of following the player)
setCameraMode ( source, "fixed" ) --Classifies which camera mode to use for the spawn screen
        setTimer ( setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) -- Set the coordinates of the camera
setTimer ( setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) --Coords for the fixated camera
        setTimer ( setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 )     -- Make the camera look at specified coordinates
setTimer ( setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 ) --Coords for the fixated camera
        bindKey ( source, "F1", "down", "Spawn as Vagos", spawnVagos )       -- Bind spawn key (function spawnVagos is not given here)
bindKey ( source, "F1", "down", "Spawn as Vagos", spawnVagos ) --Spawns player as team #1. In this case, a new function is created later on
        bindKey ( source, "F2", "down", "Spawn as Aztecs", spawnAztecs )     -- Bind spawn key (function spawnAztecs is not given here)
bindKey ( source, "F2", "down", "Spawn as Aztecs", spawnAztecs ) --Spawns player as team #2. In this case, a new function is created later on
end
end
</syntaxhighlight>
</syntaxhighlight>

Revision as of 13:06, 16 August 2007

Please remember to set players camera mode back to "player" on resource unload, or you will encounter the invisible player 'bug' if players camera is still set to fixed

This function allows you to set a player's camera to either follow him or be fixed at a certain position.

Syntax

bool setCameraMode ( player thePlayer, string mode )

Required Arguments

  • thePlayer: The player whose camera you wish to modify.
  • mode: The mode to be set. It has the following possible values:
    • "player": Sets the camera to follow a player.
    • "fixed": Fixes the camera in a set position/rotation.

Returns

Returns a bool with a value of true if the function was successful, false otherwise.

Example

function spawnScreen ( source )
        setCameraMode ( source, "fixed" )                                     -- Make the camera fixed (instead of following the player)
        setTimer ( setCameraPosition, 1000, 1, source, 160.15, -1951.68, 50 ) -- Set the coordinates of the camera
        setTimer ( setCameraLookAt, 1000, 1, source, 165, -1951.68, 50 )      -- Make the camera look at specified coordinates
        bindKey ( source, "F1", "down", "Spawn as Vagos", spawnVagos )        -- Bind spawn key (function spawnVagos is not given here)
        bindKey ( source, "F2", "down", "Spawn as Aztecs", spawnAztecs )      -- Bind spawn key (function spawnAztecs is not given here)
end

See Also