warning Not Translated
This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.
If you want to contribute a translation for this page then please click here.
PlayerSpectateVehicle
Description
Sets a player to spectate another vehicle. Their camera will be attached to the vehicle as if they are driving it.
Name | Description |
---|---|
playerid | The ID of the player who should spectate a vehicle. |
targetvehicleid | The ID of the vehicle the player should spectate. |
SPECTATE_MODE:mode | The spectate mode. Can generally be left blank as it defaults to 'normal'. |
Returns
true - The function was executed successfully. Note that success is reported if the player is not in spectator mode (TogglePlayerSpectating), but nothing will happen. TogglePlayerSpectating MUST be used first.
false - The function failed to execute. The player, vehicle, or both don't exist.
Examples
TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, vehicleid);
Notes
warning
- Order is CRITICAL! Ensure that you use TogglePlayerSpectating before PlayerSpectateVehicle.
- The playerid and vehicleid have to be in the same interior and virtual world for this function to work properly.
Related Functions
- PlayerSpectatePlayer: Spectate a player.
- TogglePlayerSpectating: Start or stop spectating.
- GetPlayerSpectateID: Gets the ID of the player or vehicle the player is spectating (watching).
- GetPlayerSpectateType: Gets the player's spectate type.