open.mp | PlayerSpectatePlayer
  • Home
  • FAQ
  • Forum
  • Servers
  • Docs
  • Blog
  • Login
  • Englishاللغة العربيةar-TNবাংলাbosanski jezikDeutschΕλληνικάEspañoleestiفارسیFrançaisHrvatskimagyarBahasa IndonesiaItaliano日本語ქართულიlietuvių kalbaNederlandsNorskjęzyk polskiPortuguêsRomânăРусскийslovenski jezikсрпски језикไทยWikang TagalogTürkçeУкраїнськаاردوTiếng Việt简体中文繁體中文
warning Not Translated

This page has not been translated into the language that your browser requested. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

PlayerSpectatePlayer

Description

Makes a player spectate (watch) another player.

NameDescription
playeridThe ID of the player that will spectate.
targetplayeridThe ID of the player that should be spectated.
modeThe mode to spectate with (optional; defaults to 'normal').

Returns

1: The function was executed successfully.

0: The function failed to execute. One of the players specified does not exist.

Examples

public OnPlayerDeath(playerid, killerid, 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.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub