it's supposed to change every shot to a specified shot type(ie laser, shockwave). however.... it doesn't seem to want to work. here's the code, anyone wanna give a look?
Code: Select all
#include "bzfsAPI.h"
#include <string>
BZ_GET_PLUGIN_VERSION
class BBCapHandler : public bz_EventHandler
{
public:
virtual void process ( bz_EventData *eventData );
std::string shootType;
};
BBCapHandler bbCapHandler;
BZF_PLUGIN_CALL int bz_Load ( const char* commandLine )
{
bz_debugMessage(4,"BaseBuilder plugin loaded");
// if (commandLine) //Commented for testing purposes
// {
// bbCapHandler.shoottype = commandLine;
// } else {
bbCapHandler.shootType = "L";
// }
bz_registerEvent(bz_eShotFiredEvent,&bbCapHandler);
return 0;
}
BZF_PLUGIN_CALL int bz_Unload ( void )
{
bz_debugMessage(4,"BaseBuilder plugin unloaded");
return 0;
}
void BBCapHandler::process ( bz_EventData *eventData )
{
bzApiString shotType = bzApiString(shootType);
if (eventData->eventType != bz_eShotFiredEvent)
return;
bz_ShotFiredEventData *shot = (bz_ShotFiredEventData*)eventData;
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, shot->type.c_str()); //simply for testing
shot->type = shotType;
shot->changed = true;
bz_sendTextMessage(BZ_SERVER, BZ_ALLUSERS, shot->type.c_str()); //again, testing
}
farther down you can see the server messages being sent. when i have it loaded, it tells me what shot i'm firing, before and after the plugin modifies it. THAT does update, meaning, that in-game it gives the abbv for whatever flag i have, and then on the next line says "L". however, it does not modify the actual shot.
i know i've seen a couple references to a zombie mod where the shots get PZ'd, but i couldn't find it, so i couldn't compare it to what i have.
i've been staring at this for hours now trying to figure out why it won't work, but i'm at my wits end. any ideas?