SetDeadSpectator: Difference between revisions
(Added a note about this bug: https://zandronum.com/tracker/view.php?id=2594#c17993) |
DrinkyBird (talk | contribs) No edit summary Tag: Source edit |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:ACSWarning}} | {{Template:ACSWarning}} | ||
bool '''SetDeadSpectator''' (int ''playernumber'', bool ''state'') | |||
==Usage== | == Usage == | ||
Turns a player that is alive into a dead spectator or vice versa. | Turns a player that is alive into a dead spectator, or vice versa. This function will only affect dead spectators or players that are alive; not true spectators. Additionally, a player cannot be forced to be a dead spectator if the game currently isn't in progress (i.e. waiting for players, or is in the countdown/results sequence). They may, however, be revived at anytime so as long as the game isn't in the results sequence. | ||
If sv_deadplayerscankeepinventory is set, the dead spectator will be resurrected with the inventory they had before they died. If sv_samespawnspot is set, the dead spectator will be resurrected at their current location. | |||
==Parameters== | === Parameters === | ||
* playernumber: Number of the player to effect | * ''playernumber'': Number of the player to effect | ||
* state: The state to set on the effected player ( | * ''state'': The state to set on the effected player (false = alive; true = dead spectator) | ||
==Examples== | === Return value === | ||
This script will turn the | Returns true on success, false on failure. | ||
== Examples == | |||
This script will turn the player specified by ''pnum'' into a dead spectator if they are alive, or resurrect them if they are a dead spectator. | |||
<syntaxhighlight lang="c" line="1"> | <syntaxhighlight lang="c" line="1"> | ||
script 29999 (int pnum) | script 29999 (int pnum) | ||
Line 21: | Line 24: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[ | == See also == | ||
* [[PlayerIsSpectator]] | |||
[[Category:ACS functions]] |
Latest revision as of 00:48, 3 July 2022
This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports. |
bool SetDeadSpectator (int playernumber, bool state)
Usage
Turns a player that is alive into a dead spectator, or vice versa. This function will only affect dead spectators or players that are alive; not true spectators. Additionally, a player cannot be forced to be a dead spectator if the game currently isn't in progress (i.e. waiting for players, or is in the countdown/results sequence). They may, however, be revived at anytime so as long as the game isn't in the results sequence.
If sv_deadplayerscankeepinventory is set, the dead spectator will be resurrected with the inventory they had before they died. If sv_samespawnspot is set, the dead spectator will be resurrected at their current location.
Parameters
- playernumber: Number of the player to effect
- state: The state to set on the effected player (false = alive; true = dead spectator)
Return value
Returns true on success, false on failure.
Examples
This script will turn the player specified by pnum into a dead spectator if they are alive, or resurrect them if they are a dead spectator.
script 29999 (int pnum)
{
if (PlayerIsSpectator(pnum) == 0) { SetDeadSpectator(pnum,1); }
else if (PlayerIsSpectator(pnum) == 2) { SetDeadSpectator(pnum,0); }
}