PHP COD2 Rules Checker
version 1.5


Requirements: Apache webserver with PHP5 support.

This script guards keeping the rules you may have set. It is designed to be run via crontab. Each minute it parses rcon status.



Functions:
1) If you choose, it can warn and then kick players with no nick (or Unknown Soldiers) - for those, who like neat statistics.

2) Next, it guards ping. Eg. the default settings does this: if a player has ping over 250, he gets warned. If his ping gets over 300 in next minute, he gets warned again and kicked. If it doesn't exceed 300, he gets warned again, or if the ping is lower than 250, the warning is cancelled.

3) Current time is announced by console to all players everytime minute digit matches preset. Once an hour, half an hour, etc. This might make your players more aware of reality and they could change more often one with another on your server.

4) IP logging feature. If enabled, players and their IP addresses are logged. You can keep track of players from the same IP and also you can ban bad guys, who try to steal admins' nicknames.

5) Gametype change on low number of present players. Let's say the vote ends up in SD and all players go away, maybe two or three remain. The game can be set to automatically change the gametype to DM if not playing already.

6) Scheduler. You can plan executing a command or more if current hour and minute match your preset - scheduled commands can include anything including exec of another config file. Maybe you could use it to disable a map or two in your vote system.



Installation:
Unpack the directory and edit settings in rcon-rules.php. Descriptions of individual variables are inside the script.
Add this line to your crontab: (change the url accordingly)
* * * * * root nice -n 4 lynx -dump http://127.0.0.1/cod2/rcon-rules.php > /dev/null 2>&1 &
or * * * * * root nice -n 4 php /var/www/cod2/rcon-rules.php > /dev/null 2>&1 &
You can include the content of list-of-kicked.php file anywhere to your site, it displays last 10 automatically kicked players.



History:
1.5
Added: Scheduled commands. (thx. for idea goes to leonpadi)

1.4
Fixed: Code cleaning, little bugfixes, function workarounds.
Added: Gametype changing on low player count.

1.3
Added: Notification message is sent to others when players get kicked (ping or bad name).

1.2
Added: Logging of players and their IP addresses.

1.1
Fixed: Checking for the corrupted ID by repeated header return added.
Added: Time announcing every hour.
Changed: Messages can be edited up in the header of script.
Fixed: Some ascii substrings were changed to alternative spelling to help more compatibility.

1.0
First working version.

Ashus
http://ashus.ashus.net