Fair4CTF: version 2.4! (updated for BZFlag 2.4 by allejo)
Posted: Tue Dec 18, 2007 11:20 am
New in v2.4:
Updated by allejo to be compatible with BZFlag 2.4.
Added LGPL v2.1 license.
New in v2.2:
fixed the "head out of scope" error in line 140
fixed the enum errors in line 444
fixed the unused var team in line 603
I don't have my windows build env set up since i built a new desktop, so i haven't had a chance to compile this, but it should work...
Let me know if there's any problems.
Major changes (v2.1):
1. The illegal grab count is cleared 60 seconds after the last illegal grab, instead of after a legit flag grab.
2. "/ctf list" now shows a list of all players, their illegal grab count, and the time of their last grab.
3. Fixed a bug that occasionally caused clients to crash.
4. Added support to turn off team messages on fair/unfair state changes (illegal grabs still trigger messages).
Any comments/concerns/feature request, let me know ;)
Straight from the README.txt:
Fair4CTF plugin version 2.1 (March 23, 2008)
Author: pacman87
Based initially on LouMan's timedctf plugin, almost entirely rewritten
In-game commands based partially on L4m3r's fairCTF plugin's handler
===========================================
FEATURES:
-control up to 4 team CTF matches
-autokick or autokill players who keep trying to grab an off-limits flag
DESCRIPTION:
This plugin allows CTF to be enabled or disabled based on each pair of teams. Fair teams are determined by the ratio of the difference in size to the size of the largest team [(large-small)/large]. This version uses a fixed maximum ratio of 0.25, so a difference of 1 player would be fair from 3v4 up, and a difference of 2 players would be fair from 6v8 up.
Each team can always take their flag, regardless of the number of players on any team. Smaller teams can take flags from larger teams (and if successful, will encourage players to switch and even the teams). CTF is only limited for the larger team.
For example, if team sizes are 3v4v5v8 (R,G,B,P), then Red, being the smallest team, could take any other flag. Green is considered "fair" with Red ( (4-3)/4 = 0.25 ), so Green can capture Red's flag. Green can also capture Blue or Purple, because Green is the smaller team. Blue cannot take Red's flag ( (5-3)/5 = 0.4 ), but can take Green's flag ( (5-4)/5 = 0.2 ) and Purple's flag. Purple cannot take any team's flag.
Also, this plugin allows players who repeatedly attempt to take a weaker team's flag when CTF is disallowed to be /killed or /kicked. Each time a player grabs a flag that's off-limits, his count will be increased. When the count reaches a configurable threshold, the player will be /killed or /kicked, depending on the plugin mode. A player who's flag is removed during a flag run due to team changes (parts or joins) will not count toward the threshold.
The illegal flag count is reset 60 seconds after the last illegal grab.
The automatic /kicking or /killing can be disable by using a threshold value of 0.
PARAMETERS:
This plugin takes one parameter: the illegal grab threshold.
This line in your *.conf file:
-loadplugin /path/to/fair4ctf,5
will set the threshold to 5. The default value is 3.
COMMANDS:
This plugin may be controlled in-game using /ctf [...]. Valid commands are:
/ctf on: activates the plugin (default state)
/ctf off: disables the plugin (allows CTF to procede unimpeeded)
/ctf kick: set the plugin to kick players who reach the illegal grab threshold
/ctf kill: set the plugin to kill players who reach the threshold (default)
/ctf obsmsgon: sends 'enabled' and 'disabled' updates to observers
Standard behavior is to only notify the teams who are affected when
allowable CTF pairings change. This setting also sends updates to observers
/ctf obsmsgoff: opposite of obsmsgon. (default state)
/ctf msgon: like obsmsgon, but for the teams playing
/ctf msgoff: like obsmsgoff, but for the teams playing
/ctf grabs: tells the current illegal grab threshold. (default is 3)
/ctf grabs #: sets the illegal grab threshold to #, where # is between 0 and 99
/ctf list: lists current players and their number of illegal grabs
All these commands require the "FAIRCTF" permission be granted.
Updated by allejo to be compatible with BZFlag 2.4.
Added LGPL v2.1 license.
New in v2.2:
fixed the "head out of scope" error in line 140
fixed the enum errors in line 444
fixed the unused var team in line 603
I don't have my windows build env set up since i built a new desktop, so i haven't had a chance to compile this, but it should work...
Let me know if there's any problems.
Major changes (v2.1):
1. The illegal grab count is cleared 60 seconds after the last illegal grab, instead of after a legit flag grab.
2. "/ctf list" now shows a list of all players, their illegal grab count, and the time of their last grab.
3. Fixed a bug that occasionally caused clients to crash.
4. Added support to turn off team messages on fair/unfair state changes (illegal grabs still trigger messages).
Any comments/concerns/feature request, let me know ;)
Straight from the README.txt:
Fair4CTF plugin version 2.1 (March 23, 2008)
Author: pacman87
Based initially on LouMan's timedctf plugin, almost entirely rewritten
In-game commands based partially on L4m3r's fairCTF plugin's handler
===========================================
FEATURES:
-control up to 4 team CTF matches
-autokick or autokill players who keep trying to grab an off-limits flag
DESCRIPTION:
This plugin allows CTF to be enabled or disabled based on each pair of teams. Fair teams are determined by the ratio of the difference in size to the size of the largest team [(large-small)/large]. This version uses a fixed maximum ratio of 0.25, so a difference of 1 player would be fair from 3v4 up, and a difference of 2 players would be fair from 6v8 up.
Each team can always take their flag, regardless of the number of players on any team. Smaller teams can take flags from larger teams (and if successful, will encourage players to switch and even the teams). CTF is only limited for the larger team.
For example, if team sizes are 3v4v5v8 (R,G,B,P), then Red, being the smallest team, could take any other flag. Green is considered "fair" with Red ( (4-3)/4 = 0.25 ), so Green can capture Red's flag. Green can also capture Blue or Purple, because Green is the smaller team. Blue cannot take Red's flag ( (5-3)/5 = 0.4 ), but can take Green's flag ( (5-4)/5 = 0.2 ) and Purple's flag. Purple cannot take any team's flag.
Also, this plugin allows players who repeatedly attempt to take a weaker team's flag when CTF is disallowed to be /killed or /kicked. Each time a player grabs a flag that's off-limits, his count will be increased. When the count reaches a configurable threshold, the player will be /killed or /kicked, depending on the plugin mode. A player who's flag is removed during a flag run due to team changes (parts or joins) will not count toward the threshold.
The illegal flag count is reset 60 seconds after the last illegal grab.
The automatic /kicking or /killing can be disable by using a threshold value of 0.
PARAMETERS:
This plugin takes one parameter: the illegal grab threshold.
This line in your *.conf file:
-loadplugin /path/to/fair4ctf,5
will set the threshold to 5. The default value is 3.
COMMANDS:
This plugin may be controlled in-game using /ctf [...]. Valid commands are:
/ctf on: activates the plugin (default state)
/ctf off: disables the plugin (allows CTF to procede unimpeeded)
/ctf kick: set the plugin to kick players who reach the illegal grab threshold
/ctf kill: set the plugin to kill players who reach the threshold (default)
/ctf obsmsgon: sends 'enabled' and 'disabled' updates to observers
Standard behavior is to only notify the teams who are affected when
allowable CTF pairings change. This setting also sends updates to observers
/ctf obsmsgoff: opposite of obsmsgon. (default state)
/ctf msgon: like obsmsgon, but for the teams playing
/ctf msgoff: like obsmsgoff, but for the teams playing
/ctf grabs: tells the current illegal grab threshold. (default is 3)
/ctf grabs #: sets the illegal grab threshold to #, where # is between 0 and 99
/ctf list: lists current players and their number of illegal grabs
All these commands require the "FAIRCTF" permission be granted.