Cam::getFollowPedViewMode
JavaScript
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");
}