// cheatChecks.cpp : Defines the entry point for the DLL application. // /* interface header */ #include "bzfsAPI.h" /* system implementation headers */ #include #include #include BZ_GET_PLUGIN_VERSION // event handler callback class cheatChecks : public bz_EventHandler { public: cheatChecks(); virtual ~cheatChecks(); virtual void process ( bz_EventData *eventData ); virtual bool autoDelete ( void ) { return false;} // this will be used for more then one event virtual void doJumpSimulation (bz_BasePlayerRecord *playerData); float spawnRange; }; cheatChecks cheatChecksHandler; BZF_PLUGIN_CALL int bz_Load ( const char* commandLine ) { bz_debugMessage(4,"cheatChecks plugin loaded"); float range = 0; if ( commandLine ) range = (float)atof(commandLine); if ( range < 0.001f ) range = 10.0f; cheatChecksHandler.spawnRange = range; bz_registerEvent(bz_ePlayerUpdateEvent,&cheatChecksHandler); return 0; } BZF_PLUGIN_CALL int bz_Unload ( void ) { bz_removeEvent(bz_ePlayerUpdateEvent,&cheatChecksHandler); bz_debugMessage(4,"cheatChecks plugin unloaded"); return 0; } cheatChecks::cheatChecks() { } cheatChecks::~cheatChecks() { } void cheatChecks::process ( bz_EventData *eventData ) { float pos[3] = {0}; switch (eventData->eventType) { case bz_ePlayerUpdateEvent: { int playerID = ((bz_PlayerUpdateEventData_V1*)eventData)->player; bz_BasePlayerRecord* player = bz_getPlayerByIndex(playerID); cheatChecks::doJumpSimulation( player ); pos[0] = ((bz_PlayerUpdateEventData_V1*)eventData)->pos[0]; bz_GetPlayerSpawnPosEventData_V1 *spawn = (bz_GetPlayerSpawnPosEventData_V1*)eventData; break; float randPos = rand()/(float)RAND_MAX; spawn->pos[2] += randPos * spawnRange; spawn->handled = true; } default: // really WTF!!!! return; } } void cheatChecks::doJumpSimulation ( bz_BasePlayerRecord *playerData) { float pos[3] = {0}; // switch (eventData->eventType) // { // // case bz_ePlayerUpdateEvent: // { // //std::cout << "test\n"; //// bz_BasePlayerRecord *player = bz_getPlayerByIndex(playerList->operator[](i)); //// doJumpSimulation(player,eventData) //// pos[0] = ((bz_PlayerUpdateEventData_V1*)eventData)->pos[0]; // bz_GetPlayerSpawnPosEventData_V1 *spawn = (bz_GetPlayerSpawnPosEventData_V1*)eventData; // break; // // float randPos = rand()/(float)RAND_MAX; // spawn->pos[2] += randPos * spawnRange; // spawn->handled = true; // } // default: // // really WTF!!!! // return; // } } // Local Variables: *** // mode:C++ *** // tab-width: 8 *** // c-basic-offset: 2 *** // indent-tabs-mode: t *** // End: *** // ex: shiftwidth=2 tabstop=8