ConsolePlayerNumber: Difference between revisions

From Zandronum Wiki
No edit summary
mNo edit summary
Tag: Source edit
Line 17: Line 17:
</syntaxhighlight>
</syntaxhighlight>


[[Category:ACS Functions]]
[[Category:ACS functions]]

Revision as of 16:53, 2 July 2022

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

int ConsolePlayerNumber (void)

Usage

Returns the number of the local player. Returns -1 if called on the server. This function is only really meaningful in client-side scripting.

Note that in a DISCONNECT script, ConsolePlayerNumber() will return the last player number the local player had, even though PlayerNumber() no longer works.

Examples

This script tells the player what his player number is:

Script 1 (void) NET CLIENTSIDE
{
    PrintBold(s: "My player number is ", d: ConsolePlayerNumber());
}