Admin.qc Release 2

by

Doug Keegan
Rip on #quake/NetQuake
doug.keegan@tamu.edu

-----


OVERVIEW
--------

I wanted to be able to run a dedicated server and have a user be able to
easily change game parameters while connected as a client, so I write admin.qc.
It uses a 3 impulse sequence to give a client admin privileges, and then other
impulses are used to perform certain functions, such as:

changing levels
changing gameplay settings
changing environment settings
kicking users


Specific capabilities are detailed later on.


SETUP
-----

I figured the best way to distribute this would be in a source-code format, as
most people like to integrate new patches with their existing code. Other than
admin.qc, a few other changes have to be made to other files. Here are the
other changes:


In progs.src, before the line 'weapons.qc', add the line:

        admin.qc


At the very end of defs.qc, add the lines:

        // server admin
        .float          admin;
        .float          indata;
        .float          kick;
        .entity         kicker;

In weapons.qc, before the line:

        if (self.impulse >= 1 && self.impulse <= 8)

in the function ImpulseCommands (ie at the beginning of the function), add
the lines:

        // administration password
        if ((self.admin != 3)&&(self.impulse != 0)) CheckAdmin();
                
        // administration toggles
        if ((self.admin == 3)&&(self.impulse != 0)) AdminCommands();
              

USE
---

Here is the section of my .rc file that I use to control my server. If any of
the impulses are already in use on your setup, change them here and in the
constant declaration section at the top of admin.qc

// admin setup

// ** IMPORTANT: because in *single player* the game is paused until the
// ** console is 'sent back up', the code may not appear to not work if you 
// ** test it with manually sent impulses in a non-multiplayer setup

// enables admin until the next level only! change to something 'secret' here
// and in the constant section of admin.qc
bind o "impulse 150 ; wait ; impulse 152 ; wait ; impulse 154 ; " 

// toggles Teamplay
bind g "impulse 84"

// toggles NoExit
bind h "impulse 78"

// toggles Deathmatch
bind j "impulse 68"

// toggles Coop
bind k "impulse 67"

// sets map to start
bind l "impulse 83"
// also impulse 49 - 54 = map dm1 - dm6
// didn't bind 'em, wanted to save keys

// goes to the nextlevel
bind u "impulse 76"

// starts kick sequence
bind i "impulse 75"

// yes answer
bind y "impulse 121"

// no answer
bind n "impulse 110"

// increase gravity by 100
bind b "impulse 71"

// decrease gravity by 100
bind v "impulse 72"

// increase friction by 0.5
bind ] "impulse 73"

// decrease friction by 0.5
bind [ "impulse 74"


// ** also impulse 69 and 70, prompt for fraglimit and timelimit, respectively
// ** the next impulse sent will be the new limit for that var.
// ** so, impulse 69, followed by impulse 30 would set fraglimit to 30.

// ** also impulse 99 will show impulse menu for admins
