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

From BZFlagWiki
Jump to navigation Jump to search
Zehra (talk | contribs)
redirect to BZFS API Functions for streamlining content
Tag: New redirect
 
(115 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{BZFS_API_Doc}}
#REDIRECT [[BZFS API Functions]]
 
 
==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.
 
===Event Registration===
BZF_API bool [[bz_registerEvent]] ( [[Events(API)|bz_eEventType]] eventType, [[Events(API)|bz_EventHandler]]* eventHandler );
BZF_API bool [[bz_removeEvent]] ( [[Events(API)|bz_eEventType]] eventType, [[Events(API)|bz_EventHandler]]* eventHandler );
 
===Non-Player Connections===
BZF_API bool [[bz_registerNonPlayerConnectionHandler]] ( int connectionID, [[bz_NonPlayerConnectionHandler]]* handler );
BZF_API bool [[bz_removeNonPlayerConnectionHandler]] ( int connectionID, [[bz_NonPlayerConnectionHandler]]* handler );
BZF_API bool [[bz_sendNonPlayerData]] ( int connectionID, const void *data, unsigned int size );
BZF_API bool [[bz_disconectNonPlayerConnection]] ( int connectionID );
 
===Player Information===
 
BZF_API bool [[bz_getPlayerIndexList ( [[bz_APIIntList]] *playerList );
BZF_API [[bz_APIIntList *[[bz_getPlayerIndexList]] ( void );
BZF_API [[bz_BasePlayerRecord *[[bz_getPlayerByIndex]] ( int index );
BZF_API bool [[bz_updatePlayerData]] ( [[bz_BasePlayerRecord]] *playerRecord );
BZF_API bool [[bz_hasPerm]] ( int playerID, const char* perm );
BZF_API bool [[bz_grantPerm ( int playerID, const char* perm );
BZF_API bool [[bz_revokePerm]] ( int playerID, const char* perm );
BZF_API bool [[bz_freePlayerRecord]] ( [[bz_BasePlayerRecord]] *playerRecord );
BZF_API const char* bz_getPlayerFlag]] ( int playerID );
BZF_API bool [[bz_getPlayerCurrentState]] ( int playerID, [[bz_PlayerUpdateState]] &state );
BZF_API bool [[bz_isPlayerPaused]] ( int playerID );
BZF_API bool [[bz_setPlayerOperator]] ( int playerId );
 
=== Team Information===
BZF_API unsigned int [[bz_getTeamPlayerLimit]] ( bz_eTeamType team )
 
=== Score Management ===
BZF_API bool [[bz_setPlayerWins]] (int playerId, int wins);
BZF_API bool [[bz_setPlayerLosses]] (int playerId, int losses);
BZF_API bool [[bz_setPlayerTKs]] (int playerId, int tks);
BZF_API bool [[bz_resetPlayerScore]] (int playerId);
 
=== Latency Information ===
BZF_API int [[bz_getPlayerLag]] ( int playerId );
BZF_API int [[bz_getPlayerJitter]] ( int playerId );
BZF_API float [[bz_getPlayerPacketloss]] ( int playerId );
 
=== Permission Group Management ===
BZF_API [[bz_APIStringList]]* [[bz_getGroupList]] ( void );
BZF_API [[bz_APIStringList]]* [[bz_getGroupPerms]] ( const char* group );
BZF_API bool [[bz_groupAllowPerm]]( const char* group, const char* perm );
 
=== Chat Messages ===
BZF_API bool [[bz_sendTextMessage]] (int from, int to, const char* message);
BZF_API bool [[bz_sendTextMessage]] (int from, [[bz_eTeamType]] to, const char* message);
BZF_API bool [[bz_sendTextMessagef]] (int from, int to, const char* fmt, ...);
BZF_API bool [[bz_sendTextMessagef]] (int from, [[bz_eTeamType]] to, const char* fmt, ...);
BZF_API bool [[bz_sentFetchResMessage]] ( int playerID,  const char* URL );
 
=== Server Management ===
BZF_API bool [[bz_restart]] ( void );
 
=== Map Management ===
BZF_API void [[bz_setClientWorldDowloadURL]]( const char* URL );
BZF_API const bzApiString [[bz_getClientWorldDowloadURL]] ( void );
BZF_API bool [[bz_saveWorldCacheFile]]( const char* file );
 
=== 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 ===
BZF_API bool [[bz_setPlayerShotType]]( int playerId, [[bz_eShotType]] shotType );
 
=== World Weapon Management ===
BZF_API bool [[bz_fireWorldWep]] ( const char* flagType, float lifetime, float *pos, float tilt, float direction, int shotID , float dt );
BZF_API int [[bz_fireWorldGM]] ( int targetPlayerID, float lifetime, float *pos, float tilt, float direction, float dt);
 
=== Server Time ===
BZF_API double [[bz_getCurrentTime]] ( void );
BZF_API float [[bz_getMaxWaitTime]] ( void );
BZF_API void [[bz_setMaxWaitTime]] ( float maxTime );
BZF_API void [[bz_getLocaltime]] ( [[bz_localTime]] *ts );
 
=== Global Database Management (BZDB) ===
BZF_API double [[bz_getBZDBDouble]] ( const char* variable );
BZF_API [[bz_ApiString]] [[bz_getBZDBString]]( const char* variable );
BZF_API bool [[bz_getBZDBBool]]( const char* variable );
BZF_API int [[bz_getBZDBInt]]( const char* variable );
BZF_API int [[bz_getBZDBItemPerms]] ( const char* variable );
BZF_API bool [[bz_getBZDBItemPesistent]]( const char* variable );
BZF_API bool [[bz_BZDBItemExists]]( const char* variable );
BZF_API bool [[bz_setBZDBDouble]] ( const char* variable, double val, int perms = 0, bool persistent = false );
BZF_API bool [[bz_setBZDBString]]( const char* variable, const char *val, int perms = 0, bool persistent = false  );
BZF_API bool [[bz_setBZDBBool]]( const char* variable, bool val, int perms = 0, bool persistent = false  );
BZF_API bool [[bz_setBZDBInt]]( const char* variable, int val, int perms = 0, bool persistent = false  );
BZF_API int [[bz_getBZDBVarList]]( bz_APIStringList *varList );
BZF_API void [[bz_resetBZDBVar]]( const char* variable );
BZF_API void [[bz_resetALLBZDBVars]]( void );
 
=== Logging ===
BZF_API void [[bz_debugMessage]] ( int level, const char* message );
BZF_API void [[bz_debugMessagef]]( int level, const char* fmt, ... )
BZF_API int [[bz_getDebugLevel]] ( void );
 
===Server Administration===
BZF_API bool [[bz_kickUser]] ( int playerIndex, const char* reason, bool notify );
BZF_API bool [[bz_IPBanUser]] ( int playerIndex, const char* ip, int durration, const char* reason );
BZF_API bool [[bz_IPUnbanUser]] ( const char* ip );
BZF_API [[bz_APIStringList]]* bz_getReports( void );
BZF_API int [[bz_getLagWarn]]( void );
BZF_API bool [[bz_setLagWarn]]( int lagwarn );
BZF_API bool [[bz_pollActive]]( void );
BZF_API bool [[bz_pollVeto]]( void );
 
=== Timed Game Management===
BZF_API bool [[bz_setTimeLimit]]( float timeLimit );
BZF_API float [[bz_getTimeLimit]]( void );
BZF_API bool [[bz_isTimeManualStart]]( void );
BZF_API bool [[bz_isCountDownActive]]( void );
BZF_API bool [[bz_isCountDownInProgress]]( void );
 
=== Custom Text Commands===
BZF_API bool [[bz_registerCustomSlashCommand]] ( const char* command, [[bz_CustomSlashCommandHandler]] *handler );
BZF_API bool [[bz_removeCustomSlashCommand]] ( const char* command );
 
===Misc===
 
==See also==
[[BZFS API]]
 
[[plug-ins]]
 
[[Category:BZFS_API_Functions]]

Latest revision as of 01:27, 10 November 2025

Redirect to: