// oneUserPerm.cpp : Defines the entry point for the DLL application. // #include "bzfsAPI.h" #include #include #include BZ_GET_PLUGIN_VERSION std::string perm; int assigned = -1; class Assigner : public bz_EventHandler { public: virtual void process ( bz_EventData *eventData ) { bzAPIIntList *playerList = bz_newIntList(); bz_getPlayerIndexList (playerList); if (playerList->size() == 1 && assigned == -1) { if (!bz_hasPerm(playerList->get(0), perm.c_str()) && bz_hasPerm(playerList->get(0), bz_perm_say)) { assigned = playerList->get(0); bz_grantPerm(assigned, perm.c_str()); } else assigned = -2; } else if (playerList->size() != 1 && assigned != -1) { if (assigned != -2) bz_revokePerm(assigned, perm.c_str()); assigned = -1; } bz_deleteIntList(playerList); } }; Assigner oneUserPermer; BZF_PLUGIN_CALL int bz_Load ( const char* commandLine ) { bz_debugMessage(4,"oneUserPerm plugin loaded"); perm = commandLine; bz_registerEvent(bz_eTickEvent,&oneUserPermer); return 0; } BZF_PLUGIN_CALL int bz_Unload ( void ) { bz_removeEvent(bz_eTickEvent,&oneUserPermer); bz_debugMessage(4,"oneUserPerm plugin unloaded"); return 0; } // Local Variables: *** // mode:C++ *** // tab-width: 8 *** // c-basic-offset: 2 *** // indent-tabs-mode: t *** // End: *** // ex: shiftwidth=2 tabstop=8