Difference between revisions of "Cleanup"

From BZFlagWiki
Jump to: navigation, search
(added some info on how the unloading part of a plugin works for 2.4)
 
(add info about Flush())
Line 9: Line 9:
 
The [[Cleanup]] function is required for all plugins. This function replaces the [[bz_Unload]] function in plugins written for 2.4 or higher. In this function all debug messages, events, map objects, and slash commands are unregistered. Available functions for this are as follows:
 
The [[Cleanup]] function is required for all plugins. This function replaces the [[bz_Unload]] function in plugins written for 2.4 or higher. In this function all debug messages, events, map objects, and slash commands are unregistered. Available functions for this are as follows:
 
* [[bz_debugMessage]]
 
* [[bz_debugMessage]]
* [[Flush]]
+
* Flush
 
* [[bz_removeCustomSlashCommand]]
 
* [[bz_removeCustomSlashCommand]]
 
* [[bz_removeCustomMapObject]]
 
* [[bz_removeCustomMapObject]]
 +
 +
The Flush() function is called once in 2.4 plugins instead of having to a [[bz_removeEvent]] remove each registered event individually.
  
 
More information on this function can be found on the [[BZFS_API_2.4_Upgrade]] page.
 
More information on this function can be found on the [[BZFS_API_2.4_Upgrade]] page.

Revision as of 19:41, 10 July 2011

Code Example

 void SAMPLE_PLUGIN::Cleanup( void ) {
     Flush(); //This removes all events that were registered with Registered()
     bz_debugMessage(4,"SAMPLE_PLUGIN plugin unloaded");
     return 0;
 }

Functions

The Cleanup function is required for all plugins. This function replaces the bz_Unload function in plugins written for 2.4 or higher. In this function all debug messages, events, map objects, and slash commands are unregistered. Available functions for this are as follows:

The Flush() function is called once in 2.4 plugins instead of having to a bz_removeEvent remove each registered event individually.

More information on this function can be found on the BZFS_API_2.4_Upgrade page.