Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* flagResetOnCap Plugin (No Parameters
- Original plugin written by flying_popcorn but
- never publicly released and modified by allejo
- to reset all flags excluding team flags.
- How to load:
- In a conf file add: -loadplugin /path/to/flagResetOnCap.so,<number of teams in the CTF map>
- In the game type: /loadplugin /path/to/flagResetOnCap.so,<number of teams in the CTF map>
- Purpose:
- After every time that a flag is captured this plugin will reset all super flags and bad
- flags to make sure that the flags are evenly spread out. This also prevents players from
- over using a certain flag. Please note this plugin only resets flags after someone
- captures the flag, this plugin will NOT reset the flags in a FFA, KOTH, or Rabbit Hunt.
- If there is a team in existence playing in the CTF game there is going to be a player
- limit for that team, now the plugin checks that player limit and if it's more than one
- player for a certain them than it will assume it is a 1-Way CTF. It then will check the
- next team and if it's more than one player it will assume it is a 2-Way CTF. And so on.
- License: GPLv3
- */
- #include "bzfsAPI.h"
- #include <string>
- #define TOTAL_CTF_TEAMS 4
- BZ_GET_PLUGIN_VERSION
- // event handler callback
- class ONCAPHandler : public bz_EventHandler
- {
- public:
- virtual void process ( bz_EventData *eventData );
- };
- ONCAPHandler OnCapHandler;
- BZF_PLUGIN_CALL int bz_Load ( const char* commandLine)
- {
- bz_debugMessage(4,"flagResetOnCap plugin loaded");
- bz_registerEvent(bz_eCaptureEvent,&OnCapHandler);
- return 0;
- }
- BZF_PLUGIN_CALL int bz_Unload ( void )
- {
- bz_removeEvent(bz_eCaptureEvent,&OnCapHandler);
- bz_debugMessage(4,"flagResetOnCap plugin unloaded");
- return 0;
- }
- unsigned int getNumTeams()
- {
- return TOTAL_CTF_TEAMS - (!bz_getTeamPlayerLimit(eRedTeam) +
- !bz_getTeamPlayerLimit(eGreenTeam) +
- !bz_getTeamPlayerLimit(eBlueTeam) +
- !bz_getTeamPlayerLimit(ePurpleTeam));
- }
- void ONCAPHandler::process ( bz_EventData *eventData )
- {
- for(int i = getNumTeams(); i < bz_getNumFlags(); i++)
- bz_resetFlag(i);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement