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 getPublicPort: Difference between revisions

From BZFlagWiki
Jump to navigation Jump to search
Sigonasr2 (talk | contribs)
Create API Function Page. Include Example.
 
Zehra (talk | contribs)
redirect, since functions are in official docs
Tag: New redirect
 
Line 1: Line 1:
{{apicall
#REDIRECT [[Category:BZFS API Docs]]
| name          = bz_getPublicPort
| returns      = A number containing the port the server is communicating through.
| returntype    = int
| description  = Retrieves the port the server communicates with. Normally this is specified with the '''-p''' BZFS option, but defaults to 5154.
}}
 
===Example===
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;

Latest revision as of 02:01, 7 December 2025