Cam::getFollowPedViewMode

From RAGE Multiplayer Wiki
Revision as of 15:53, 9 November 2024 by Shr0x (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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