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

Bz getCountdownRemaining

From BZFlagWiki
Revision as of 21:09, 25 September 2015 by Allejo (Talk | contribs) (Allejo moved page Bz getCountdownProgress to Bz getCountdownRemaining: Renamed function)

Jump to: navigation, search

int bz_getCountdownProgress ()


Retrieves the time remaining in a running countdown.

Returns:
The amount of time remaining in a match in seconds, or -1 if a match is not currently in progress.


Example

Display the remaining time to a user upon joining.

case bz_ePlayerJoinEvent: {
	int player = (bz_PlayerJoinPartEventData_V1*)eventData)->playerID;
	if (bz_isCountDownActive()) {
	 	bz_sendTextMessagef(BZ_SERVER, player,
	 		"Welcome! The current match will finish in %d seconds!", bz_getCountdownProgress());
	} else {
	 	bz_sendTextMessage(BZ_SERVER, player,
	 		"Welcome! No match is currently running.");
	}
}break;