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

Difference between revisions of "Bz getLoadedPlugins"

From BZFlagWiki
Jump to: navigation, search
(New page: {{BZFS_API_Doc}}{{BZFS_API_Funcs}} ===Syntax=== int bz_getLoadedPlugins( bz_APIStringList * list ) ===Parameters=== * '''''list''''': A pointer to the bz_APIStringList to store t...)
 
(Updated to the modern template. Added example.)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{BZFS_API_Doc}}{{BZFS_API_Funcs}}
+
{{apicall
 +
| name          = bz_getLoadedPlugins
 +
| returns      = The number of plugins that are currently loaded.
 +
| returntype    = int
 +
| description  = Retrieves the names of all loaded plugins and counts how many of them there are.
 +
| param1      = list
 +
| param1type  = [[bz_APIStringList]]*
 +
| param1desc  = The pointer to a [[bz_APIStringList]] list for storing/appending the plugin names to.
 +
}}
  
===Syntax===
+
===Example===
int bz_getLoadedPlugins( [[bz_APIStringList]] * list )
+
Displays the list of plugins when a player joins the server, mimicking the output you would expect from the command '''/listplugins'''.
 
+
case bz_ePlayerJoinEvent: {
===Parameters===
+
bz_APIStringList list;
* '''''list''''': A pointer to the [[bz_APIStringList]] to store the names of all loaded plug-ins.
+
int count=bz_getLoadedPlugins(&list);
 
+
for (int i=0;i<count;i++) {
===Returns===
+
bz_sendTextMessagef(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"%d %s",i+1,list.get(i).c_str());
The number of loaded plugins.
+
}
 
+
}break;
===Description===
+
This API function appends all currently loaded plug-ins to the end of a [[bz_APIStringList]].
+
 
+
===See Also===
+
[[bz_loadPlugin]], [[bz_unloadPlugin]], [[bz_registerCustomPluginHandler]], [[bz_removeCustomPluginHandler]]
+

Latest revision as of 10:03, 19 October 2011

int bz_getLoadedPlugins (bz_APIStringList* list)


Retrieves the names of all loaded plugins and counts how many of them there are.

Parameters:
list  -  The pointer to a bz_APIStringList list for storing/appending the plugin names to.
Returns:
The number of plugins that are currently loaded.


Example[edit]

Displays the list of plugins when a player joins the server, mimicking the output you would expect from the command /listplugins.

case bz_ePlayerJoinEvent: {
	bz_APIStringList list;
	int count=bz_getLoadedPlugins(&list);
	for (int i=0;i<count;i++) {
		bz_sendTextMessagef(BZ_SERVER,((bz_PlayerJoinPartEventData_V1*)eventData)->playerID,"%d %s",i+1,list.get(i).c_str());
	}
}break;