In-Game Banning With QSmack

Once a QSmack client has been started, a server admin (or any other player with admin privileges) wants the ability to add and delete players from the ban list. You could, of course, do this by stopping QSmack, changing the ban file, and then restarting QSmack, or by iconifying quake and firing up the frontend, but it would be especially convenient if you could ban that really annoying player while you were actually playing without leaving Quake. Well, QSmack lets you do it. Here's how.

You start up Quake, connect to the server that QSmack is also connected to, and gain admin privileges. Now any time you send a special impulse (237 in the server code we provide), your name is printed out to to all clients who have admin privileges. This includes you (so you have confirmation that you have admin and the special impulse was sent correctly), and, most importantly, it includes QSmack. Why would you want to do this? Well, before doing that impulse, you can change your name to any string of 15 characters or less, which means that essentially this impulse lets you send many different commands to QSmack, since when QSmack sees the print, it will interpret it as a command.

The command print is prefixed by "#qsmack_command# " (this part is added by the server) so that QSmack can recognize it as a command. This also makes the command print impervious to spoofing by other clients, due to the nature of strings that are sent by the Quake server and the limit on the length of names for players.

Currently, the following commands are supported. Remember, to invoke the command you have to make your name the command to execute and then send an impulse 237 (or whatever impulse your server code uses for this). Then you can change your name back. :-) Note: any command that causes the ban lists to change will cause the ban file to be rewritten with the new list. In this way, any changes you make will stay in effect even if QSmack or the server goes down.

This will cause QSmack to reread the ban file. Useful if you have manually made new entries in the ban file.
IP address
Not literally "IP address", but any valid IP address, including wildcards. You can specify addresses in the exact same way you do in the ban file. For example, make your name "1.2.3.*", and send impulse 237 to ban that subnet. Hey, isn't it kinda lucky that the maximum length of a name in Quake is exactly the same as the maximum length of an IP address? 15 characters!
ban playernumber

First do a "status" at the console and find out the player number of the person you want to ban. This number will be between 1 and 16. Now change your name to "ban 2", or "ban 13", or whatever is appropriate, and send that special impulse. Say bye-bye to the loser. This will ban a single IP address (that of the banned player).

With no arguments, the "ban" command will instead cause QSmack to "say" the current list of banned names and IPs. It looks kind of like this:

C9_AutoAdmin: Banned Ips:
C9_AutoAdmin: 1
C9_AutoAdmin: 2
C9_AutoAdmin: 3
C9_AutoAdmin: 4 157.22.179.*
C9_AutoAdmin: Banned Names:
C9_AutoAdmin: 5 [\r\n]
C9_AutoAdmin: Banned Colors:
C9_AutoAdmin: 5 13 4

The numbers listed in front of each IP and name can be used in the "unban" command.

ban_color shirt pants

This command has the same format as the "ban_color" command found in the ban file. For example, to ban those pesky players who wear lightblue, change your name to "ban_color 2 2" and send that impulse 237.

unban number
Here, the number is the number next to the IP or name you want to remove from the banlist. Use the "ban" command with no arguments to find out the numbers. So, for example, to remove the IP from the list shown above you would change your name to "unban 2", then send impulse 237. (After each IP or name you remove, the list gets renumbered starting from 1, so re-execute a "ban" command after each "unban" command to see the new numbering if you need to do more unbanning.)