Title    : Clan Arena Server Code
Filename : clanarena13.zip
Version  : 1.3
Date     : 3-26-98
Author   : Mungo
Email    : bml@netwiz.net
Webpage  : http://www.planetquake.com/servers/arena
---------------------------------------------------

                                PlanetQuake's
                     Clan Arena mod v1.3 for Quakeworld
                     ----------------------------------

Clan arena is like clanring or qwring for the most part. You join a server,
"ready up", and once everybody is set to a team, the match begins.

************
New for v1.3
************

        - fixed "grenade from a dead teammate damages you on teamplay 1" bug
        - fixed "getting stuck in platform" bug
        - fixed status line in trackcam
        - added teamplay 4
          with teamplay 4, you cannot damage a teammate's health OR armor,
          this includes damage done to yourself

for v1.2

        - new "oldteam" rules
        - new menus option
          see the section called "menus"
        - new setup command
          see the section called "the setup command"
        - toggle-able countdown centerprint
        - new fullteams option

for v1.1

        - new "pickup" command
        - in track cam, your armor and health match the armor and health
          of the person you're tracking
        - settable auto-pushlatency setting for track cam
          see "pl"
        - settable status-bar size
          see "sbar"
        - "crush" bug fixed
        - All varaibles but "teams" and "rounds" can be set between rounds
          instead of between entire series
        - Server admins can set up their server to be a "pickup" server
          see the section called "Pickup Server"


*****
Menus
*****

Menus are a new way for people to quickly and easily set up team games with
clan arena.  When the server is in competition or round-robin modes, each
player is given a menu listing the teams that they can join.  When they
select a team from the menu, their colors are automatically set and they
become a member of the team.  While waiting for the match to begin, they're
given a second menu which lets them pick a shirt color, set their skin to
base, or uncommit.  Also, if everyone but one person is "ready", the name of
the person who's holding things up is given to everone.

To choose an option from the menu, either hit the number key corresponding
to the option number, or type the number in at the console.

Menus are enabled by the server admin from the server.cfg file.


*****************
The setup command
*****************

The setup command is a quick and easy way to set up a match between teams.
When you type the "setup" command, the first thing that happens is a voting
starts to give you admin privileges.  Alternatively, you can become admin on
your own with the "admin" command.  Once you are admin, you are taken through
a series of menus that will configure the game.
As an example we will assume that you want to set up a 4on4 on dm3.  On the
first menu, when it asks how many teams, you would hit 2.  The second menu
asks how many players per team, you would enter 4 here.  The third menu
asks how many rounds to play.  For the example, you would hit 4 to choose
best of 9 rounds.  The next menu asks if you want "fullteams" enabled or not.
For more information about what "fullteams" does, see the commands section.
For the example you would hit 1 for yes.  Finally, on the last menu, you
choose option 2, for "dm3".  Once you are taken to dm3, the setup is complete.
All you have to do now is have each person join a team, and once everyone
has committed to a team, the match will start.


*************
Pickup Server
*************

If you set the server variable "pickup" to "1" in the server.cfg, the server
will run in "pickup" mode.  In "pickup" mode, the the mod behaves
differently in the following ways:

        - The mod is always in "competition" mode

        - The "modeset" and "lock" commands are disabled

        - There's no server timeout

        - The "autolock" server variable still works, since it's the
          server admin's decision whether or not the server be locked

It's recommended that you set "pickup" with "serverinfo" instead of
"localinfo".  This way, a person viewing the server settings from GameSpy
will see if the server is a pickup server or not.


************
Server Setup
************

To set up a Clan Arena server,
1. Extract the files in the caserver.zip into a 'quake\carena' directory.

2. Copy the pak0.pak from your Final Arena (quake\arena) directory
into your Clan Arena directory (quake\carena).
The Final Arena client pak is required to run a Clan Arena server (it includes
maps and sounds). It is available from: http://www.planetquake.com/servers/arena

3. Customize the server.cfg in the quake\carena directory to your
preferences.

        For people interested in running a server dedicated to playing
        team games, the best configuration for this is to have
        "autolock" off, "menus" on, "pickup" on, "fullteams" off,
        "teams" set to 2, and "players" set to 6.  (this is the
        default server.cfg configuration in the clan arena archive)

4. Start the server with a command line like:
'qwsv +gamedir carena'

The sv_gamedir variable is set to 'arena' in the server.cfg, so clients
will use the Final Arena pak file in their 'quake\arena' directories.


********
Features
********

Modes
~~~~~

There are three different modes for clan arena:

- Normal Mode

Normal mode is where there are no teams and there is just one line of people.
People fight, and the winner fights the next player in line. When you lose a
fight, you go to the end of the line.  "players" controls how many people are
put into the arena at once.  If "players" is set to 3, 3 people would play
a 1on1on1.  If set to 4, it would be a 4 way.

- Competition Mode

A certain number of players are chosen from each team, determined by the
"players" setting, and placed into the arena.  When someone dies, someone
from his team replaces him (if there is someone left to replace him), and
everyone in the arena keeps their armor/health.  Once all but one team has
been eliminated, the round ends.  By default, a best of 9 rounds is played.
("rounds" setting controls the number of rounds played).  A different player
from each team starts the next round.  Once the series of rounds ends, the
team with the most wins in given the victory.

- Round Robin Mode

Only one player from each team is put into the arena.  As soon as the fight
ends the winner is teleported out to make room for the next set of players.
The series ends when everyone on a team has had a chance to play against
everyone else.  Keep in mind that this can create a large number of matches.
For example, a 2-team 4on4 would need to play 16 matches.  A 3-team 4on4on4
would be 64 matches long.  This mode should probably only be used for clans
interested in holding "official" matches, with 4 players to a team.
NOTE:  This mode forces "players" to 1, and "rounds" is set automatically

Number of Players
~~~~~~~~~~~~~~~~~

In Clan Arena, the number of players to be put into the arena is fully
configurable.  For example, if "players" is set to "3" on normal arena,
3 people would be put into the arena, making for a 1on1on1, with the last
one standing the winner.
In competition mode, if "players" is set to "2", two players from every
team are put into the arena at once.  For example, if there are 2 teams,
4 people would be put into the arena, making for a 2on2.

Number of Teams
~~~~~~~~~~~~~~~

The number of teams participating at once can be anywhere between 2 and 4.
This controls the MAXIMUM number of teams allowed.  The minimum to start
a game is always 2.

Arena on Any Map
~~~~~~~~~~~~~~~~

Clan Arena doesnt require an arena map to be played.  Clan Arena works
on id maps.  In fact, it can also work on any map, as long as the map
name is specified in the server's localinfo as an "id-style" map.
Check the sample server.cfg for an example of how to do this.

Spectators on id Maps
~~~~~~~~~~~~~~~~~~~~~

All non-players are non-solid spectators who can not be seen or heard. All
spectators have a null team value and are color 0 (white). A non-solid
spectator cannot move through a solid, including other players.
While you are a spectator, you can either walk around on your own,
or use the tracking camera. To use the tracking camera, press the attack
button, and then use the jump button to track the various players. If you
want to exit the track cam mode, press the attack button again.

Re-joining a Series
~~~~~~~~~~~~~~~~~~~

If you disconnect from a server before a series ends, you can reconnect
before the series ends and you should be placed back on your team the
very next round.  If you want to explicitly substitute someone, have them
do "setinfo oldteam <teamname>" before they connect, and they should be
placed on the team the very next round.  NEW in v1.2:  This will work even
if the team is not missing anyone.  In this way you can add people to a team
mid-series.


********
Commands
********

settings
~~~~~~~~

This command is like modstatus in qwring, it shows the current settings of
the clan arena mod. Each setting can be changed by an admin by typing:
"/setinfo <setting> <value>" in the quake console. The available settings
are listed below.

atype           - armor type. 1 = red armor, 2 = yellow armor,
                              3 = green armor, 4 = no armor

armor		- how much armor you start with.
health		- how much health you start with.

(NOTE: an ammo value of 999 specifies unlimited ammo of that type of ammo.)

shells		- number of shells you start with. 
nails		- number of nails you start with.
rockets		- number of rockets you start with.
cells		- number of cells you start with.

teamplay        - standard teamplay variable.
players		- number of players from each team to fight at the same time.
NOTE:           There are two different players settings.  One is for normal
                mode and defaults to 2, the other is for Competition mode and
                defaults to 4.
teams           - maximum number of teams.

mode            - current mode of server.
                  (Normal, Competition, or Round Robin)
fullteams       - if "on", the mod will wait for all the teams to fill up
                  before starting the match, as opposed to starting the match
                  when every person has "readied" regarldless of if the teams
                  are uneven
centerprint     - if "on", you will get a countdown printed to the center of
                  the screen and "FIGHT!" when the match has begun.

NOTE:  When changing settings with the "setinfo" command, you will need to
wait for next round for them to take effect.  The "mode" setting is changed
with the "modeset" command, the "centerprint" setting is changed with the
"cprint" command, and the "fullteams" setting is changed with the "fullteams"
command.

playerlist
~~~~~~~~~~

The playerlist command shows which team each player belongs to. If the team
field is blank for a player, it means that player is not on a team.
Thre are 4 fields, labeled "F D H S".  They mean, "fired", "direct hits",
"hits", "self-inflicted", respectively, and are a total accout of all the
rockets the player has fired.  These numbers are reset at the beginning of
each series.

yes
~~~

This command is used to vote yes for an election to admin.

no
~~

This command is used to vote no for an election to admin.

listmaps
~~~~~~~~

Lists the maps in the map loop. The map loop is set the same way that the
standard quakeworld map loop is set.  If the current map is not in the map
loop, this command will only list the current map, and the last map that was
in the loop.

elect
~~~~~

Used by a normal player to become admin.  During the voting time, a person
votes with "yes" and "no". The voting is controlled with the server variables
"votepct" and "votetime".  "votepct" controls the percentage of votes that
must be "yes" in order for the person to become an admin.  For example, if
there are 6 people on the server, and votecpt is "50", there would need to
be at least 3 "yes" votes in order for the person to be admin'd.
The server variable "votetime" is the number of seconds the voting lasts.
Default is 60.  If "votepct" is not set or is 0, voting is disabled.

ready
~~~~~

Adds you to the team you have specified, or enables the team you have
specified.  To specify your team, use the "team" console command.
If you join a team that's already been created, your colors will be changed
to match the team colors.

This command is disabled on servers using the menus.

admin
~~~~~

Use this command to become an admin if you enter the correct admin code. The
admin code is four digits, and you enter one digit at a time.

commands
~~~~~~~~

List available commands, and the impulse for the command.

notready
~~~~~~~~

Removes you from the team you have specified, and if you were the only player
on your team, "notready" clears the old team.

scores
~~~~~~

Only works in either Competition or Round Robin modes.  It shows the teams
participating in the current series and how many wins/losses/forfeits they
have.

nopl
~~~~

Use this command to toggle on and off auto-pushlatency mode.
When auto-pushlatency is enabled, your pushlatency will be set to 0 when you
enter track cam mode, and when you exit track cam mode, your pushlatency will
be set to -500. When auto-pushlatency is disabled, your pushlatency setting
will not be changed at all.  The default setting of auto-pushlatency is on.
If you disconnect when you are in track cam mode, the mod will not have a
chance to correct your pushlatency setting, so keep this in mind when using
"nopl".
Note that the track cam is smoothest when your pushlatency is set to 0.

cprint
~~~~~~

Toggles the centerprinted countdown on or off.

setup
~~~~~

Gives a series of menus to help setup a match quickly.  Explained fully
in the section called "the setup command"


**************
Admin Commands
**************

pickup
~~~~~~

Clears the teams and colors for everyone on a server.  Can only be used
in Competition or Round-Robin modes when a series is not being played.
It clears any teams already created so you will need to set your team
and type "ready" again.
Useful to help set up a pickup game.

modeset
~~~~~~~

This command swicthes the mode of the clan arena mod.
If the server is running in "pickup" mode, this command is disabled.

warp
~~~~

This command is used to change maps. Enter one number at a time.
If you want to choose an id map, enter the episode number for the
first digit, the second digit is the level number.  Deathmatch maps
are chosen with 5, episode 1 with 6, episode 2 with 7, and so on.
For example, to choose dm6, enter:
warp
5
6

To choose e1m2, enter:
warp
6
2

start map is chosen with "58", end with "99"

reset
~~~~~

Use this command to reset the mod.

force
~~~~~

This command is used to start a series even though all players have not
readied up.  If "fullteams" is on and the teams are uneven, you cant use
"force" to start anyway.

kick
~~~~

When you enter this command, a list of players and their associated player
numbers will be displayed. To remove a player from the server, enter the
number of the player you wish to kick. Remember to enter one digit at a time.

lock
~~~~

This command toggles whether or not the server is locked. When the server is
locked, no players are allowed to join the server.  See: autolock.  If the
server is locked manually with this command, autolock will be disabled.
The server automatically unlocks if there are no more players on the server,
or the level is changed.
If the server is running in "pickup" mode, this command is disabled.

fullteams
~~~~~~~~~

Toggles the "fullteams" setting on or off.  With fullteams on, the mod
waits for all teams to fill up before starting a match, with it off, the
match starts as soon as everyone on the server has readied.
For example, if you were trying to set up a 4on4 on dm3.  If 5 people
join the server, 4 of whom create team A, the last creating team B, the
match starts with 4 people on team A against one person on team B.  To
get around this problem, enable fullteams, and set "teams" to 2 and "players"
to 4.  This way the server will not start the match until there are 4
people apiece on 2 different teams.

sg, ssg, ng, sng, gl, rl, lg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use these to toggle on/off a specific weapon


*******
Weapons
*******

Weapons mask
~~~~~~~~~~~~

To set the weapons variable, you set up a bitmask.
The vaules for the bits are:
Bit    Value    Weapon
----------------------
 0       1      Lightning gun
 1       2      Rocket Launcher
 2       4      Grenade Launcher
 3       8      Super Nailgun
 4      16      Nailgun
 5      32      Super Shotgun
 6      64      Shotgun

Add the values of all the weapons you want together, and that is what you
set "weapons" to.
For example, all weapons would be 127
Just the rocket launcher, grenade launcher, and lightning gun would be 7
Just the rocket launcher would be 2
All weapons instead of the grenade launcher would be 123

Weapon Toggling
~~~~~~~~~~~~~~~

The admin can use the 7 weapon toggle commands (one for each weapon) to turn
off or on a specific weapon.  This is usually easier than setting the
bitmask.


******************
Personal Variables
******************

NOTE: These are set with "setinfo" from the console.  It would be convenient
      to set these from your personal .cfg file (or autoexec.cfg).

pl
~~

If set, the mod uses this number to set your pushlatency when you exit track-
cam mode instead of the default "-500".  For example, if you want a
pushlatency of "-250", then do: "setinfo pl -250"

sbar
~~~~

Set this to the vertical resolution of your screen to move the status bar
output to the bottom of the screen.  For example, if your screen resolution
is 640x480, then you'd set "sbar" to "480" with the command:
"setinfo sbar 480"

NOTE: Do NOT set the status-bar size to a size larger than your screen
      resolution.  If you do, your qwcl will crash.

To turn the status bar off, set "sbar" to "0".

oldteam
~~~~~~~

If you join a server that has a series in progress, during the time between
rounds it will check to see if a team is missing a player.  If your "oldteam"
variable is set to the name of the team that is missing a player, the mod will
place you on that team.  For example, if team "foo" is missing a player, you
would set "oldteam" to "foo" with the command: "setinfo oldteam foo", then
you'd be put on team "foo" the next round.


****************
Server Variables
****************

sounds
~~~~~~

The clan arena mod may be configured to use two sets of sounds. If you prefer
the Street Fighter sounds, set the server variable "sounds" to 0. If you
prefer the Mortal Kombat sounds, set "sounds" to 1. The Mortal Kombat sounds
are used by default.

autolock
~~~~~~~~

If "autolock" is set to 1, then the server automatically locks iself before
each series begins, and unlocks after each series.  If set to 0, autolocking
is disabled.

menus
~~~~~

If set to 0, this will disable the menus.  If 1, this will enable menus.
See the section called "menus" for a description.

pickup
~~~~~~

If set to 0, the server behaves as normal.  If set to 1, the server will
run in "pickup" mode.
See the section called "pickup server" for a description.

fullteams
~~~~~~~~~

If set to 0, "fullteams" is by default off.  If 1, it's on by default.
"fullteams" can still be changed by an admin.

admincode
~~~~~~~~~

This sets the 4 digit admin code.  Make sure this is defined with localinfo
and NOT serverinfo! (unless you dont mind everyone knowing the admin code)

votepct
~~~~~~~

The percentage of votes that must be "yes" in order for the person to be
voted an admin.  This number should be between 0-100.  For example, a
"votepct" of "50" means 50%.  This is the default.  If set to 0, voting
is disabled.

votetime
~~~~~~~~

The amount of time a vote will last, in seconds.  Default is 60.

setinfo variables
~~~~~~~~~~~~~~~~~

All of the "setinfo" variables settable by an admin can also be set in the
server.cfg.  These values are only loaded once, when the server first starts.
They are set using the "localinfo" command.  For example, if you wanted
"cells" set to 999, you'd put the following line in the server.cfg:
localinfo cells 999

A list of the "setinfo" variables is given in the description of the
"settings" command.



*******
Credits
*******

Authors
~~~~~~~

Mungo   (bml@netwiz.net)        Coding
eof     (apathy@cw.umd.edu)     Server admin, ideas, testing, docs

Thank yous
~~~~~~~~~~

Gemini:                 idea of arena on id maps
Sketch:                 original trackcam idea
crt:                    doc help, fullteams suggestion
4u2c:                   menus idea, teamplay 4 idea, server admin and testing
[1]protocol:            server admin and testing
hilander:               server admin and testing
Phazer, TvAddict:       suggestions
Zoid:                   street fighter sound effects
Angoris and Gemini:     original arena conecpt
SS|NiOXiN:              original arena map

Testers
~~~~~~~

clan SS:                NiOXiN, Soylent, Rush, BodyCount, MicroMegas, Grunt
clan EW:                Artemis, Glock, Sketch, Monk3y, Cloud, Nitro, Nova
clan EG:                Drakken, Pistdov
clan WD:                RCade
clan Cluck:             Mib, Roadwar
clan FFF:               Psy, DemonX
Phazer, TvAddict, Nacho, P00p, Peaches, Hawk'D, Tess[eh]

NOTE:  This list doesnt have all the names, since we couldnt possibly
       remember them all.  A big thanks goes to all the testers, and
       sorry if we missed your name here!
