PlayerSpectateVehicle

PlayerSpectateVehicle

Description:

Function PlayerSpectateVehicle sets a player to spectate another vehicle. Their camera will be attached to the vehicle as if they are driving it.


Parameters:

(playerid, targetvehicleid, mode = SPECTATE_MODE_NORMAL)
int playerid The ID of the player who should spectate a vehicle.
int targetvehicleid The ID of the vehicle the player should spectate.
int mode The spectate mode. Can generally be left blank as it defaults to 'normal'.


Return Values:

  • 1: 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.
  • 0: The function failed to execute. The player, vehicle, or both don't exist.


Examples:

TogglePlayerSpectating(playerid, 1);
PlayerSpectateVehicle(playerid, vehicleid);


Related Functions

The following functions may be useful, as they are related to this function in one way or another.