BZFlag Plugin Template

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
SkillDude
Private First Class
Private First Class
Posts: 336
Joined: Sun Apr 01, 2007 4:50 pm
Location: United States

BZFlag Plugin Template

Post by SkillDude »

This is a basic outline template for developing BZFlag plugins. I often find it tedious to type the same starting things over and over, so here are the basics, a little more than what the SAMPLE_PLUGIN provides, and a few comments that have some starter code for various things. I found it annoying to have to always start from SAMPLE_PLUGIN and fill in missing things, or start from more complete plugins and erase unnecessary pieces. This is the perfect medium, hope other plugin developers find it useful.

Code: Select all

// Template.cpp : A generic plugin template to get you going.

#include "bzfsAPI.h"
//#include "plugin_utils.h"  //Provides some additional useful functionality.

class Template : public bz_Plugin, bz_CustomSlashCommandHandler
{
	virtual const char* Name(){return "Plugin Template";}

	virtual void Init ( const char* /*config*/ );
	
	virtual void Event(bz_EventData *eventData );

	virtual void Cleanup ( void );

	virtual bool SlashCommand ( int playerID, bz_ApiString command, bz_ApiString message, bz_APIStringList* params );
	
	public:
		//Variables.
		
};

BZ_PLUGIN(Template)

void Template::Init (const char*config) {
	//bz_registerCustomSlashCommand ( "", this );
	//Register(bz_ePlayerJoinEvent);
}

void Template::Cleanup (void) {
	//bz_removeCustomSlashCommand ( "" );
	//Flush();
}

bool Template::SlashCommand ( int playerID, bz_ApiString command, bz_ApiString message, bz_APIStringList* params ) {
	
	return true;
}

void Template::Event(bz_EventData *eventData ){
	switch (eventData->eventType) {
	 /*case bz_ePlayerJoinEvent: {
		int playerID=((bz_PlayerJoinPartEventData_V1*)eventData)->playerID;
		
	 }break;*/
	}
}
Post Reply