Chuyển tới nội dung chính

PlayerSpectateVehicle

Description

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

NameDescription
playeridThe ID of the player who should spectate a vehicle.
targetvehicleidThe ID of the vehicle the player should spectate.
SPECTATE_MODE:modeThe 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

cảnh báo
  • 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.