Cam::getFollowPedViewMode: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
0 - Third Person Close
1 - Third Person Mid
2 - Third Person Far
4 - First Person
{{ClientsideJsFunction}}
{{ClientsideJsFunction}}
{{JSContainer|
{{JSContainer|
===Explanation===
The `getFollowPedViewMode` function retrieves the current camera view mode used to follow the player’s character (ped). It returns an integer representing the view mode, which you can use to determine the player's current perspective.
===View Mode Values===
* 0 - Third Person Close
* 1 - Third Person Mid
* 2 - Third Person Far
* 4 - First Person


===Return value===
===Return value===
*''' {{RageType|number}} '''
*'''{{RageType|number}}''' — The view mode ID as an integer.


==Syntax==
==Syntax==
Line 16: Line 20:


==Example==
==Example==
This example checks the current view mode and displays a message based on the player’s perspective.
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
//todo
// Get the current follow ped view mode
const viewMode = mp.game.cam.getFollowPedViewMode();
 
switch(viewMode) {
    case 0:
        mp.gui.chat.push("View Mode: Third Person Close");
        break;
    case 1:
        mp.gui.chat.push("View Mode: Third Person Mid");
        break;
    case 2:
        mp.gui.chat.push("View Mode: Third Person Far");
        break;
    case 4:
        mp.gui.chat.push("View Mode: First Person");
        break;
    default:
        mp.gui.chat.push("Unknown View Mode");
}
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 15:53, 9 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


Explanation

The `getFollowPedViewMode` function retrieves the current camera view mode used to follow the player’s character (ped). It returns an integer representing the view mode, which you can use to determine the player's current perspective.

View Mode Values

  • 0 - Third Person Close
  • 1 - Third Person Mid
  • 2 - Third Person Far
  • 4 - First Person

Return value

  • 'number' — The view mode ID as an integer.

Syntax

mp.game.cam.getFollowPedViewMode()

Example

This example checks the current view mode and displays a message based on the player’s perspective.

// Get the current follow ped view mode
const viewMode = mp.game.cam.getFollowPedViewMode();

switch(viewMode) {
    case 0:
        mp.gui.chat.push("View Mode: Third Person Close");
        break;
    case 1:
        mp.gui.chat.push("View Mode: Third Person Mid");
        break;
    case 2:
        mp.gui.chat.push("View Mode: Third Person Far");
        break;
    case 4:
        mp.gui.chat.push("View Mode: First Person");
        break;
    default:
        mp.gui.chat.push("Unknown View Mode");
}


See also