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

Difference between revisions of "Bz getPublicDescription"

From BZFlagWiki
Jump to: navigation, search
(Create API Function Page. Include Example.)
 
(wording improvement)
 
Line 3: Line 3:
 
| returns      = A string containing the public title / description of the server.
 
| returns      = A string containing the public title / description of the server.
 
| returntype    = [[bz_ApiString]]
 
| returntype    = [[bz_ApiString]]
| description  = Retrieves the string with the title of the server, generally displayed on the list server when players are finding a game to join. This is what you would specify with the '''-publictitle''' BZFS option.
+
| description  = Retrieves the string with the title of the server, generally displayed on the list server when players are finding a game to join. This is what one would specify with the '''-publictitle''' BZFS option.
 
}}
 
}}
  

Latest revision as of 22:29, 25 November 2016

bz_ApiString bz_getPublicDescription ()


Retrieves the string with the title of the server, generally displayed on the list server when players are finding a game to join. This is what one would specify with the -publictitle BZFS option.

Returns:
A string containing the public title / description of the server.


Example[edit]

A simple greeting that tells the player what server and port they are on. This may be useful to remove the hassle of modifying greetings for a server that hosts many ports.

case bz_ePlayerJoinEvent: {
	if (bz_getPublic()) {
		bz_sendTextMessagef(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"Welcome!");
		bz_sendTextMessagef(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,
			"You are playing on %s",bz_getPublicDescription().c_str());
		bz_sendTextMessagef(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,
			"           @ %s:%d",bz_getPublicAddr().c_str(),bz_getPublicPort());
	}
}break;