Post Thu Sep 18, 2014 9:34 am

How to Install Sourcebans (or MySQLOO) on Garry's Mod

This tutorial covers how to install sourcebans and mysqloo on Garry's Mod 13 using the local MySQL database we provide all customers. If you require the sourcebans website or need external MySQL access please contact us. This tutorial is for Windows customers, for Linux please contact us.

First, download the prerequisites:

gmsv_mysqloo_win32.dll
http://drakehawke-gmod.googlecode.com/s ... _win32.dll

Sourcebans lua files:
http://lex.me.uk/modules/sourcebans.lua
http://lexi.org.uk/modules/sourcebans_example.lua

Note: libmysql.dll is not required, as long as you install the MySQL extra in the control panel libmysql.dll will be copied to the right place. Even if you reinstall the server via our panel the file will be put back.

1. Edit sourcebans.lua and remove require("gatekeeper");
2. Edit sourcebans_example.lua and fill in your MySQL database details. If you'd like to use the provided local MySQL database install the MySQL extra from the "Extras" tab of our control panel. Then return and click the "Login Info" button to get the details. In addition, adjust dbprefix to "sb" to use the usual sourcebans prefix, or if you have existing tables, enter what the prefix should be.
3. Upload gmsv_mysqloo_win32.dll to lua/bin.
4. Upload sourcebans.lua to lua/includes/modules.
5. Upload sourcebans_example.lua to lua/autorun/server.
6. Restart the server. After the server comes up verify everything is in place:

Run "show processlist;" from the MySQL Database section under "Extras" in the control panel. You should see two rows, one for the game server and another for the processlist command:

  Code:
Id   User   Host   db   Command   Time   State   Info
5029327   xxx_dbuser   localhost:55987   xxx_cp   Sleep   880      
5031592   xxx_dbuser   localhost:58274   xxx_cp   Query   0   init   show processlist


On the RCON tab of the control panel, try the command sm_ban. If the response is:
  Code:
Usage: sm_ban <#userid|name> <minutes|0> <reason>

then the lua is properly loaded.

If you aren't seeing the expected result for a) or b) turn on Console Logging in the "Console Logs" section of the control panel. Restart the server, let it come up, then restart it again (on Windows you can only see the previous console log, not the second). Check for errors related to mysqloo or sourcebans and contact us for further assistance. The regular output looks like this:

  Code:
ServerLog: [09/18/14 14:19:24][SourceBans.lua] Starting the database.