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.
functions (API)
| BZFS API Documentation This page contains part of the BZFS API documentation for use by Plug-ins on the BZFS server. | 
Overview
The BZFS API provides a number of functions to plug-ins for use in querying the current game state. Functions are used both to get information about the game, and to trigger in game actions, such as activating a world weapon.
Function Groups
Functions are broken into a series of groups based on the type of action or information they deal with.
Team Information Functions
BZF_API unsigned int bz_getTeamPlayerLimit ( bz_eTeamType team )
=== Server Management
BZF_API bool bz_restart ( void );
Map Management
BZF_API void bz_setClientWorldDowloadURL( const char* URL );
This function sets the current URL used to download a cached world file. It will be sent to clients that connect giving them the option of using that file. This is helpful if you have changed the map file during a reload.
BZF_API const bzApiString bz_getClientWorldDowloadURL( void );
Returns the current world URL.
BZF_API bool bz_saveWorldCacheFile( const char* file );
Forces the server to save out a world cache file into the specified file. Returns false on failure.
These commands are in CVS for both 2.0.x and 2.1 as of now.
I'm sure the Restart function will need some work but any help testing it will be greatly appreciated.
Flag Management
BZF_API bool bz_givePlayerFlag ( int playerID, const char* flagType, bool force ); BZF_API bool bz_removePlayerFlag ( int playerID ); BZF_API void bz_resetFlags ( bool onlyUnused ); BZF_API unsigned int bz_getNumFlags ( void ); BZF_API const bz_ApiString bz_getName( int flag ); BZF_API bool bz_resetFlag ( int flag ); BZF_API int bz_flagPlayer ( int flag ); BZF_API bool bz_getFlagPosition ( int flag, float* pos ); BZF_API bool bz_moveFlag ( int flag, float pos[3], bool reset = true );
Shot Type Control
2.1 now has messages and functions that let you modify the shot type of a tank. The shot type is now independent of the flag you carry. When the shot type is changed, the client will pick up on that change and it will start shoting shots of that type. Once changed, you do NOT have to change the shot type of every shot fired. And yes, the shoting client WILL see the modified shot type, so the entire state will be in sync.
BZF_API bool bz_setPlayerShotType( int playerId, bz_eShotType shotType );
This will set the current shot type for the player. Any shots fired after the shot type is sent will be of this new type.
you can also set the shotType field in the bz_eGrabFlagEvent event, and the shot type will be sent with the flag pickup ( this is the best way to do it ).
Any time a player spawns or drops a flag, there shot type will be reset to the standard shot type, and should be reset, if you want to change the default shots.