This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.

Bz getPlayerFlag: Difference between revisions

From BZFlagWiki
Jump to navigation Jump to search
No edit summary
Sigonasr2 (talk | contribs)
id -> ID, added an example.
 
Line 1: Line 1:
{{apicall
{{apicall
| name          = bz_getPlayerFlag
| name          = bz_getPlayerFlag
| description  = Gets the flag id of the flag that the specified player is currently holding.
| description  = Gets the flag ID of the flag that the specified player is currently holding.
| param1        = playerID
| param1        = playerID
| param1type    = int
| param1type    = int
| param1desc    = The id of the player to check
| param1desc    = The id of the player to check
| returntype    = const char*
| returntype    = const char*
| 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
| 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===
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;

Latest revision as of 06:22, 19 October 2011

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

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;