PlayerSpectateVehicle

From SA-MP Wiki

Jump to: navigation, search


Description:

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)
playeridThe ID of the player who should spectate a vehicle.
targetvehicleidThe ID of the vehicle the player should spectate.
modeThe spectate mode. Can generally be left blank as it defaults to 'normal'.


Return Values:

  • 1: The function 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.


Image:32px-Circle-style-warning.png

Important
Notes

  • 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.


Example Usage:

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.

Personal tools
In other languages