note Help Needed
This wiki is the result of an ongoing community effort — thank you all for helping!
If you want to provide changes to this page then please click here.
PlayerSpectatePlayer
Description
Makes a player spectate (watch) another player.
Name | Description |
---|---|
playerid | The ID of the player that will spectate. |
targetplayerid | The ID of the player that should be spectated. |
SPECTATE_MODE:mode | The mode to spectate with (optional; defaults to 'normal'). |
Returns
true - The function was executed successfully.
false - The function failed to execute. One of the players specified does not exist.
Examples
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
{
TogglePlayerSpectating(playerid, 1);
PlayerSpectatePlayer(playerid, killerid);
return 1;
}
Notes
warning
- Order is CRITICAL! Ensure that you use TogglePlayerSpectating before PlayerSpectatePlayer.
- playerid and targetplayerid's virtual world and interior must be the same for this function to work properly.
Related Functions
- PlayerSpectateVehicle: Spectate a vehicle.
- 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.