Both sides previous revisionPrevious revisionNext revision | Previous revision |
new:player [2018/02/20 14:43] – korshun | new:player [2018/02/21 12:29] (current) – korshun |
---|
| ~~NOCACHE~~ |
====== Player utilities ====== | ====== Player utilities ====== |
| |
| |
Also, remember that "no player" is player number -1, while player number 0 is the first player. | 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. |
| |
| |
''str PlayerName(int player)'' | ''str PlayerName(int player)'' |
| |
Returns the player's name. Shorthand for ''StrParam(n:player+1)''. | Returns the player's name. Shorthand for ''StrParam(n:player + 1)''. |
| |
==== GetPlayerTeam ==== | ==== GetPlayerTeam ==== |
| |
Returns the player's team number, or ''TEAM_NONE''. Shorthand for ''GetPlayerInfo(player, PLAYERINFO_TEAM)''. | Returns the player's team number, or ''TEAM_NONE''. Shorthand for ''GetPlayerInfo(player, PLAYERINFO_TEAM)''. |
| |
| |
| |