ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


new:player

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
new:player [2018/02/18 18:20] – created korshunnew:player [2018/02/21 14:29] (current) korshun
Line 1: Line 1:
 +~~NOCACHE~~
 ====== Player utilities ====== ====== Player utilities ======
 +
 +Stuff related to dealing with players and teams.
  
 ===== Constants ===== ===== Constants =====
  
-  * ''MAX_PLAYERS'' -- maximum player count in Zandronum multiplayer (64)+  * ''MAX_PLAYERS = 64'' -- maximum player count in Zandronum multiplayer. 
-  * ''MAX_PLAYERS_ZDOOM'' -- maximum player count in ZDoom multiplayer (8).+  * ''MAX_PLAYERS_ZDOOM = 8'' -- maximum player count in ZDoom multiplayer.
   * ''TEAM_NONE = 255'' -- team number meaning "no team".   * ''TEAM_NONE = 255'' -- team number meaning "no team".
 +
 +Also, remember that "no player" is player number -1, while player number 0 is the first player.
 +
 +===== SetActivatorToPlayer2 =====
 +
 +''bool SetActivatorToPlayer2(int player)''
 +
 +A replacement for both [[zdoom>SetActivator]] with ''AAPTR_PLAYERx'' and [[zan>SetActivatorToPlayer]] that works in any port.
 +
 +[[zdoom>SetActivator]] with ''AAPTR_PLAYERx'' only supports up to 8 players, while [[zan>SetActivatorToPlayer]] isn't supported in ZDoom. This function attemps to use ''SetActivatorToPlayer'', and then ''SetActivator(AAPTR_PLAYERx)''. This way, it works in both ZDoom and Zandronum.
 +
 +
 +===== Player classification =====
 +
 +  * ''bool PlayerIsConnected(int player)'' -- returns true if the player is connected to the server.
 +  * [[zdoom>PlayerIsBot]]
 +  * [[zdoom>PlayerInGame]]
 +  * [[zdoom>PlayerIsSpectator]]
 +  * ''bool PlayerIsDeadSpectator(int player)'' -- returns true if the player is a dead spectator.
 +
 +Functions to count various classes of players:
 +
 +  * ''int ClientCount()''
 +  * ''int BotCount()''
 +  * [[zdoom>PlayerCount]] 
 +  * ''int SpectatorConunt()''
 +  * ''int DeadSpectatorCount()''
 +  
 +Functions to pick a random player:
 +
 +  * ''int PickRandomClient()''
 +  * ''int PickRandomBot()''
 +  * ''int PickRandomPlayer()''
 +  * ''int PickRandomSpectator()''
 +  * ''int PickRandomDeadSpectator()''
 +
 +  * ''int PickRandomTeamPlayer(int team)'' -- pick a random in-game player from the team.
 +
 +
 +===== Actor information =====
 +
 +==== ActorPlayerNumber ====
 +
 +''int ActorPlayerNumber(int tid)''
 +
 +If the actor is a player, returns its player number. Otherwise returns -1.
 +
 +==== IsPlayer ====
 +
 +  * ''bool IsPlayer()''
 +  * ''bool ActorIsPlayer(int tid)''
 +
 +Returns true if the actor is a player.
 +
 +
 +===== Player information =====
 +
 +==== PlayerName ====
 +
 +''str PlayerName(int player)''
 +
 +Returns the player's name. Shorthand for ''StrParam(n:player + 1)''.
 +
 +==== GetPlayerTeam ====
 +''int GetPlayerTeam(int player)''
 +
 +Returns the player's team number, or ''TEAM_NONE''. Shorthand for ''GetPlayerInfo(player, PLAYERINFO_TEAM)''.
 +
 +
 +
 +===== Team information =====
 +
 +==== TeamPlayerCount ====
 +''int TeamPlayerCount(int team)''
 +
 +Returns the number of players on the specified team. Shorthand for ''GetTeamProperty(team, TPROP_NumPlayers)''.
 +
 +
 +===== ConsolePlayer shorthands =====
 +
 +  * ''bool ConsolePlayerInGame()'' -- shorthand for ''PlayerInGame(ConsolePlayerNumber())''.
 +  * ''str ConsolePlayerName()'' -- shorthand for ''PlayerName(ConsolePlayerNumber())''.
 +  * ''int ConsolePlayerTeam()'' -- shorthand for ''GetPlayerTeam(ConsolePlayerNumber())''.
 +  * ''bool SetActivatorToConsolePlayer()'' -- shorthand for ''SetActivatorToPlayer2(ConsolePlayerNumber())''.
 +
  
new/player.1518970859.txt.gz · Last modified: 2018/02/18 18:20 by korshun