GetCameraViewMode: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(add ped camera modes) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | {{Client function}} | ||
{{New feature/item|3.0160|1.5.8|20851|Now you can get the camera mode when the [[player]] is not inside a [[vehicle]].}} | |||
This function allows you to get the camera's view mode. This indicates at what distance the camera will follow the player. | This function allows you to get the camera's view mode. This indicates at what distance the camera will follow the player. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
int getCameraViewMode ( ) | int, int getCameraViewMode ( ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||Camera.getCameraViewMode|viewMode|setCameraViewMode}} | {{OOP||Camera.getCameraViewMode|viewMode|setCameraViewMode}} | ||
===Returns=== | ===Returns=== | ||
Returns | Returns two [[int]] indicating the current camera view modes. Their meanings can be seen below. | ||
{{Camera view modes}} | {{Camera view modes}} | ||
Line 25: | Line 26: | ||
function currentCam(key) | function currentCam(key) | ||
if (getControlState(key)) then | if (getControlState(key)) then | ||
outputChatBox("Your current cam view is: ".. | local vehicleMode, pedMode = getCameraViewMode() | ||
outputChatBox("Your current cam view is: "..vehicleMode..".") | |||
end | end | ||
end | end |
Revision as of 05:36, 8 April 2021
Now you can get the camera mode when the player is not inside a vehicle.
This function allows you to get the camera's view mode. This indicates at what distance the camera will follow the player.
Syntax
int, int getCameraViewMode ( )
OOP Syntax Help! I don't understand this!
- Method: Camera.getCameraViewMode(...)
- Variable: .viewMode
- Counterpart: setCameraViewMode
Returns
Returns two int indicating the current camera view modes. Their meanings can be seen below.
Vehicle Modes:
- 0: Bumper
- 1: Close external
- 2: Middle external
- 3: Far external
- 4: Low external
- 5: Cinematic
Ped Modes:
- 1: Close
- 2: Middle
- 3: Far
Example
This example tells the player their current camera view when they change it
function onPlayerSpawn ( theSpawnpoint ) currentCam("fire") -- start a repeating check end addEventHandler ( "onClientPlayerSpawn", root, onPlayerSpawn ) function currentCam(key) if (getControlState(key)) then local vehicleMode, pedMode = getCameraViewMode() outputChatBox("Your current cam view is: "..vehicleMode..".") end end