By
Chris "The Guru"
Welcome to what I hope will guide you through setting up Halflife-Admin_mod and MySQL..
This will not be an in depth linux guide.. if you don't know or have Linux.. then you don't belong here.
This document assumes quite a few things..
- You already have MySQL installed, and have a ROOT account set up
- You have downloaded HalfLife-Admin_mod and installed it.
- Yu have more than just user access to the server, MySQL and the HLDS_L directory
(if you installed #1 and #2 I would assume you do)
Very well, then we'll begin.
There are 3 critical pieces of information that Admin_Mod requires for authentication, they are:
- Nickname
- password (plaintext)
- permissions (access rights)
*** YOUR DATABASE CAN HAVE INFINITELY MORE INFORMATION!! but these 3 are required ****
let's first look at the server.cfg file.. and see what it tells us about setting this up.
____ BEGIN SERVER.CFG ____
1.// admin_cfg files
2. users_file "users.ini"
3. vote_freq_map 300
4. vote_freq_kick 300
5. kick_ratio 0.7
6. map_ratio 0.5
7. nicks_file "nicks.ini"
8. nicks_kick_msg "You have attempted to use a reserved nickname without proper clearance"
9. maps_file "maps.ini"
10. reserve_slots 0
11. mysql_host localhost.localdomain
12. mysql_user hladmin
13. mysql_pass xxxxxxxx
14. mysql_dbtable_users hladmin.clientbase
15. mysql_dbtable_nicks hladmin.clientbase
16. password_field pw-gameservername
___ END SERVER.CFG ____
Line 1: a remark line to keep things organized.
Line 2: users_file "users.ini" - When you are using the MySQL version of Admin_mod this is not required.. but I put one there with at least MY nickname password and access set to 65535 (so if there is catastrophic failure of the SQL there is at least SOME administration)
Line 3: vote_freq_map 300 - Determines the time between map_voting (5 minutes = 300 seconds) a map_vote cannot be called in less than this timespan.. regardless of whether or not it was successful or not.
Line 4: vote_freq_kick 300 - Sets timespan between when a kick_vote can be called.
Line 5: kick_ratio 0.7 - 70% of the users most vote in the affirmative to kick someone.
Line 6: map_ratio 0.5 - 50% of connected users must vote yes to switch map.. (if you have ever tried to get a consensus of ANYTHING from a bunch of gamers, you know that this value sometimes needs to be ridiculously low to get anything to happen)
Line 7: nicks_file "nicks.ini" - same as Line 2, not required for the SQL version, but I keep it there just in case.
Line 8: nicks_kick_msg "byebye" - this is the last thing someone sees if they try to use a protected nickname (be informative, but not abusive.. it could be an honest error)
Line 9: maps_file "maps.ini" - this is the list of maps (without the .bsp) that you can allow users to vote for. (makes sure they don't try to load up reserved maps) - this file is reloaded when maps reload
Line 10: reserve_slots 0 - I know this is a good idea, but honestly.. on my server, if there's one slot open.. everyone slams the heck out of it constantly trying to get in.. let personal preferance be your guide.
ALRIGHT.. now we get to the meat and potatoes of setting up the MySQL portion of this.
Line 11: mysql_host - in this case.. localhost.localdomain (since game and SQL server are on same machine) if you want to run it as a clustered server (and it works fine BTW) then you specify the real domain that this machine can contact the MySQL server on.
Line 12: mysql_user hl_admin : I created a special READ ONLY account in the MySQL server for the HLServer.. so that when it logs in it uses the username hl_admin to pull it's data
(don't worry, we will get to this in the harder parts)
Just remember, this is the login name that the game uses to communicate with the SQL server.. (please remember this.. it's important.. the SQL server has it's OWN SECURITY!! INDEPENDANT OF THE MACHINE YOU'RE USING!)
Line 13: mysql_pass - since it has to use it's own account, the Admin_mod also has to know the password for the account. (and thus the reason for the 'read only' access permitted, if someone compromises your .cfg files, they can't make changes to the database)
Line 14. mysql_dbtable_users hladmin.clientbase - this actually contains 2 pieces of information. the first is the database name that's being used.. and then the actual table that we're after.. for simplicity I have Nicks and Users configured in the same table.. (it makes things easier for me)
Line 15. mysql_dbtable_nicks hladmin.clientbase - this gives you the ability to have nicknames be different from admin_mod users.. I didn't see the sense in this since people are going to have to authenticate anyway I might as well have the potential to grant any of them limited admin commands.. (of course, most of them are set to 0 anyway..)
Line 16: password_field pw-gameservername - this is the unique password field that everyone must have in their AUTOEXEC.CFG otherwise, they can't do diddly. (personally mine is pw-guruspace) make it unique to prevent confusion when people play on multiple admin_mod servers.. (if it becomes a problem I may set up a pw-servername registry)
-- Getting it all Together --
VERY IMPORTANT!!! -- go to http://www.mysql.com and get the documentation.. this is not intended to be a MySQL tutorial, nor is it a Linux How-To, it is intended to ONLY address the aspect of MySQL that Admin_mod references.
IF you have MySQL configured (at least operational) first thing we need to do is create the dataset for use with admin_mod. I have chosen to call my dataset "hladmin".
- Log in to your MySQL
(please make sure you are ROOT or have ROOT-like SQL priveledges)
- create the database (in this case "hladmin")
- Select the database (USE hladmin)
- ADD THE hladmin account with appropriate domain and permissions
CREATE DATABASE hladmin;
USE hladmin;
GRANT SELECT ON hladmin.* TO user@host IDENTIFIED BY
'password';
- create the table for the actual user data..
(if you look at lines 14 and 15 I have define the database as hladmin, and the table as : clientbase)
create table CLIENTBASE
(nick varchar(30) binary primary key not null, pass varchar(50) not null,
access bigint(6) unsigned zerofill);
This line will create the rudimentry database table with the key columns of NICK ACCESS and PASS (which are what admin_mod is looking for)
From here it becomes completely personal preference..
you can use MySQL Admin for windows to set up, control access.. what ever....
I have also used MS-Access in conjunction with the MySQL ODBC driver to remote administer the database.
Once you have MySQL running, with everything configured in a combination of personal preference and what is up above, then you will be able to start Half_Life admin_mod..
If you are setting up multiple server (TFC, CStrike, FireArms) you can customize the databases and tables as neccessary.. but the rudimentary information is NICK, PASS, ACCESS..
if those table are present, then you will get basic function out of Admin_mod.
Anything else you chose to do with the database is up to you.
|