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

bz_getPlayerFlag

From BZFlagWiki
Jump to: navigation, search

const char* bz_getPlayerFlag (int playerID)


Gets the flag ID of the flag that the specified player is currently holding.

Parameters:
playerID  -  The id of the player to check
Returns:
The two-character flag ID of the flag that the player specified is holding, or NULL if the player does not exist or is not currently holding a flag.

Example[edit]

When a player grabs a flag, display to the player what the flag symbol of the flag they grabbed is.

case bz_eFlagGrabbedEvent: {
	bz_sendTextMessagef(BZ_SERVER,((bz_FlagGrabbedEventData_V1*)eventData)->playerID,
		"You grabbed the %s Flag."
		,bz_getPlayerFlag(((bz_FlagGrabbedEventData_V1*)eventData)->playerID));
}break;