bz BasePlayerRecord

From BZFlagWiki
Revision as of 03:45, 15 October 2011 by JeffM2501 (Talk | contribs) (note what happened to the email)

Jump to: navigation, search
BZFS API Documentation This page contains part of the BZFS API documentation for use by Plug-ins on the BZFS server.

BZFS Class. This page documents a BZFS API class that is defined by the game server API. Plug-ins receive various classes in able to retrieve information about players and the game state from the server.


The bz_BasePlayerRecord is an API class that is provided to expose information about a connected player to the plug-in.


Class bz_BasePlayerRecord has the following data members:

int version 
The version number of this API class ;
int playerID 
The player ID for the player.
bz_ApiString callsign 
The username/callsign for the player.
bz_eTeamType team 
The team the player is currently on.
float lastUpdateTime 
The server time of the last player update
bz_PlayerUpdateState lastKnownState 
The state record that was last sent
bz_PlayerUpdateState currentState 
The predicted state at the current time, representing where the server and all remote users show the player at.
bz_ApiString ipAddress 
The Internet Protocol v4 address of the connected client
bz_ApiString currentFlag 
The flag code of the flag to give to the player. The flag code format is a string that looks like "FLag (+FL)" Where letters that make up the flag abbreviation is capitalized. So for example, Narrow is Narrow and Wings is WinGs. The content in parenthesis include a + sign if the flag is a good flag or a - sign if the flag is a bad flag followed by the symbol of the flag. If no flag is being held, this parameter is simply an empty string. The actual values outputted by this member can also be clarified on the 5th & 6th pages of the "Help" section in-game.
bz_APIStringList flagHistory 
A list of strings representing the names of all the flags the player has held, in order from newest to oldest.
bool spawned 
True if the user has spawned and is playing.
bool verified 
True if the user has authenticated with the login system. Comparable to a user having a "+" in the scoreboard.
bool globalUser 
True if the user name was authenticated using the global login system as opposed to a local one.
bz_ApiString bzID 
The globally unique ID for authenticated users.
bool admin 
Is true by default if user has the BAN permission. Sets the "@" sign.
bool op 
True if the user is identified as a server operator via /password
bool canSpawn 
True if the user has permissions to spawn (BZFlag 2.99).
bz_APIStringList groups 
The list of groups the user is a member of
int lag 
The user's current lag amount in milliseconds.
int jitter 
The user's current jitter amount in milliseconds.
float packetloss 
The user's current packet loss percentage.
int wins 
The number of kills the user has had.
int losses 
The number of deaths the user has had
int teamkills 
The number of team mates the user has killed.


The class provides a number of methods for various utility functions;


void update ( void );

This method will update the player record with the most current data. This is usefully if a plug-in stores the pointer to the class and wishes to use it with current data.


bool hasPerm ( const char* perm );

This method will return true if the user has the permission with the specified name.


bool grantPerm ( const char* perm );

This method will give the user the permission with the specified name, and return true if the operation was successful.


bool revokePerm ( const char* perm );

This method will remove the user the permission with the specified name, and return true if the operation was successful.


This class is returned by a number of API functions and events. This class is used any time player specific data is requested.

Removed Fields

The email field was removed with version 2.4 since it was removed from the game and changed to "motto"