This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "Bz getAdmin"

From BZFlagWiki
Jump to: navigation, search
(Added return value. Updated description to reflect what the function checks for, not what it returns.)
(Added an example.)
Line 10: Line 10:
 
| returns      = True if the player specified is an administrator; false otherwise
 
| returns      = True if the player specified is an administrator; false otherwise
 
}}
 
}}
 +
===Example===
 +
Displays a custom message if the player joins and is identified as an administrator.
 +
if (bz_getAdmin(((bz_PlayerJoinPartEventData_V1*)eventData)->playerID)) {
 +
bz_sendTextMessage(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"Welcome! Do not forget to check up on admin news with /adminnews!");
 +
}

Revision as of 05:58, 19 October 2011

bool bz_getAdmin (int playerID)


Checks to see if the specified player is an administrator.

Parameters:
playerID  -  The id of the player to check for admin status
Returns:
True if the player specified is an administrator; false otherwise

Example

Displays a custom message if the player joins and is identified as an administrator.

if (bz_getAdmin(((bz_PlayerJoinPartEventData_V1*)eventData)->playerID)) {
	bz_sendTextMessage(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"Welcome! Do not forget to check up on admin news with /adminnews!");
}