PlayerIsSpectator: Difference between revisions

From Zandronum Wiki
(Created page with "{{Template:ACSWarning}} int '''PlayerIsSpectator''' (int ''player'') ==Usage== Takes one argument, which is the player number it uses and returns the spectator status. ====...")
 
No edit summary
Tag: Source edit
 
Line 2: Line 2:
int '''PlayerIsSpectator''' (int ''player'')
int '''PlayerIsSpectator''' (int ''player'')


==Usage==
== Usage ==
=== Parameters ===
* ''player'': The player number to check the spectator status of.


Takes one argument, which is the player number it uses and returns the spectator status.
=== Return value ===
 
====Return value====
* '''0''' if the player is not a spectator
* '''0''' if the player is not a spectator
* '''1''' if the player is a true spectator
* '''1''' if the player is a true spectator
* '''2''' if the player is a dead spectator (when a player was killed and waits for the round to end to respawn)
* '''2''' if the player is a dead spectator (when a player was killed and waits for the round to end to respawn)


==Examples==
== Examples ==
 
<syntaxhighlight lang="c" line="1">
<syntaxhighlight lang="c" line="1">
Script 1 (int player) DISCONNECT
Script 1 (int player) DISCONNECT
Line 27: Line 26:
</syntaxhighlight>
</syntaxhighlight>


[[category:ACS Functions]]
[[category:ACS functions]]

Latest revision as of 01:35, 3 July 2022

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.

int PlayerIsSpectator (int player)

Usage

Parameters

  • player: The player number to check the spectator status of.

Return value

  • 0 if the player is not a spectator
  • 1 if the player is a true spectator
  • 2 if the player is a dead spectator (when a player was killed and waits for the round to end to respawn)

Examples

Script 1 (int player) DISCONNECT
{
    if (!PlayerIsSpectator(player))
    {
        PrintBold(s: "Someone disconnected.");
    }
    else if (PlayerIsSpectator(player))
    {
        PrintBold(s: "Someone became a spectator.");
    }
}