GetPlayerInfo

From ZDoom Wiki
Jump to navigation Jump to search

int GetPlayerInfo (int playernumber, int playerinfo)

Usage

Retrieves player-related information. To get information for the player who activated the script, use the PlayerNumber function.

Parameters

  • playernumber
The player to get the information from.
  • playerinfo
One of:
  • PLAYERINFO_TEAM
Which team the player is on. No team is 255 always. Without use of the TEAMINFO lump the teams are: 0 for blue, 1 for red, 2 for green, 3 for gold, 4 for black, 5 for white, 6 for orange or 7 for purple.
  • PLAYERINFO_AIMDIST
How far the player autoaims.
  • PLAYERINFO_COLOR
The player's color, as 0xRRGGBB in hexadecimal.
  • PLAYERINFO_GENDER
The player's gender: 0 for male, 1 for female, and 2 for other.
  • PLAYERINFO_NEVERSWITCH
The player's neverswitchonpickup setting.
  • PLAYERINFO_MOVEBOB
The player's movebob setting.
  • PLAYERINFO_STILLBOB
The player's stillbob setting.
  • PLAYERINFO_FVIEWBOB (New from 4.11.0)
The player's fviewbob setting.
  • PLAYERINFO_PLAYERCLASS
A number representing the player's class. In Hexen, this is 0 for the fighter, 1 for the cleric, and 2 for the mage. Note that this is the player class the player has selected (playerclass cvar), not necesarilly the one the player is currently playing with - to get the current player class number, use PlayerClass.
  • PLAYERINFO_FOV
The player's current FOV.
  • PLAYERINFO_DESIREDFOV
The player's fov setting.

Return value

Returns the value of the given property of the specified player. If you ask for information about a player who is not in the game, it will return -1. If you ask for an unknown information it will return 0.

Examples

This script opens a door only if the player is Female:

script 1 (void)
{
	if(GetPlayerInfo(PlayerNumber(), PLAYERINFO_GENDER) == 1)
		Door_Open(1, 20);
	else
		Print(s:"sorry dude, ladies only");
}