MySCAL (MySQL Server Configs & Admin Logging)
Foreword
I am looking for any suggestions for this plug-in, I currently class this plug-in as BETA because I am looking for feedback from the community, although I am using for my game servers. See my thoughts/suggestions below.
My Thoughts/Suggestions:
If you have any suggestions, please reply below, I saw two very good ideas and merged them together into a single 'viable' solution for larger communities with lots of game servers.The over writing of the map specific configs coudl be a pain in the rear for some users. I could add the ability to run map specific configs (even down to generic CS_* or DE_* map config files if needed).Wondering whether it would be an idea, to try and run the map specific config file after the plug-in has finished loading?? Done simply in V1.1
- I was looking through the functions and noticed that it could be possible to also write the mapcycle.txt file also, is this a feature you would want and actually use?
- Need to add in game command to run the configs again if needed
- Will look at menu integration (never done this before, so might be a while)
- Would error logging based upon server ID be useful to anyone else than me?
- Would logging of every command (that appears in the SM log files) be useful to anyone else than me?
What Does it Do?
This plug-in allows server operators to store their server.cfg file entries in a MySQL database, rather than have server config files scattered across each server and to control them from a single location.
After approximately 3 seconds of the map loading, this plug grabs the configs from a database where the server number matches and then executes them.
If any map specific config files exist eg mapname.cfg it will now run these in your cfg folder automatically.
Also its capable of logging admin commands to a MySQL Database as well. As I use
HSFighter's web interface (link below), it made absolute sense to add this as well, as in theory its only a simple search based upon Steam ID, to keep a record of the commands an admin has made.
Also as a fail-safe, if the connection fails, server plug-in will run "server_back.cfg".
Web Interface Coming Soon!
The web interface is being worked up by
HSFighter and will be released later this week in this thread:
http://forums.alliedmods.net/showthread.php?t=60174
I am hoping that it may end up looking similar to this for CSS:
http://www.cstrike-planet.com/cfgmaker?cfg=srcds
CVars
sm_myscal_version - Duh
sm_myscal_enable - Default: 1 - Enables and disables this plugin
sm_myscal_server_no - Server Number (see notes below)
sm_myscal_log_enable - Default: 1 - Enables/Disables Admin Command Logging
Installation
1. A working MySQL Connection,
http://wiki.alliedmods.net/SQL_Admin...#Configuration noting that this plug-in will use what ever the default one is.
2. Run the SQL below or attached in the .sql file on your database to create the tables
3. Put this plugin in your <mod dir>/addons/sourcemod/plugins/ folder
4. Change maps.
FYI: The cvar is held in ' Command_Name' and the value is held in 'Command_Value', this also means you could also do "exec somefile.cfg" if needed
Optional:
Server Number:
After entering your server configs to the database in columns, you may want to think about server numbers. you will need to add the following to your server.cfg file:
PHP Code:
sm_myscal_server_no X // Where X is the server number
FailSafe:
If the database connection fails, the plugin will attempt to run "server_backup.cfg", this of course could have been your original server.cfg which you have renamed.
SQL:
Below and attached, is the SQL to create the two tables, you will see that its prepared for
HSFighter's web console (after one squillion PM's, loooool)
Server Config:
PHP Code:
CREATE TABLE IF NOT EXISTS sm_servercfg(
ID int(11) PRIMARY KEY auto_increment,
Server_ID int(11),
Command_Name varchar(255) NOT NULL default '',
Command_Value varchar(255) NOT NULL default '',
Value_Key varchar(255) NOT NULL default '',
Default_Key varchar(255) NOT NULL default '',
Type varchar(16) NULL,
time_modified timestamp(14) NOT NULL default
CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
)TYPE=MyISAM;
Admin Logging:
PHP Code:
CREATE TABLE `smwa`.`sm_logging` (
`ID` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`Server_ID` INT( 11 ) NOT NULL ,
`steamid` VARCHAR( 100 ) NOT NULL ,
`logtag` VARCHAR( 100 ) NOT NULL ,
`message` VARCHAR( 255 ) NOT NULL ,
`time_modified` TIMESTAMP( 14 ) ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY ( `ID` )
) ENGINE = MYISAM
CVars that do not work & special considerations!
So far I have only found one CVar that does not work using this method and that is
sv_downloadurl, this must be set in the server.cfg file.
We have hundreds of admins, within a a few days we had already topped the 1000 command mark that the admin logging function had stored, over a long period of time, this map be a problem for someone with a small database allowance.
Version History
V1.0 - First release
V1.1 - Added the function to run map specific cfg files automatically
Thanks to..Matt