This wiki is archived and useful information is being migrated to the main bzflag.org website
Difference between revisions of "Bz getPlayerFlag"
From BZFlagWiki
(id -> ID, added an example.) |
|||
Line 1: | Line 1: | ||
{{apicall | {{apicall | ||
| name = bz_getPlayerFlag | | name = bz_getPlayerFlag | ||
− | | description = Gets the flag | + | | 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 | + | | 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[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;