Table of Contents
Clockwork now supports SQLite, which means you no longer need to setup a database, but setting one up is still recommended.
So you've installed Clockwork and a schema, and you're wanting to set it up so you can finally get into the roleplaying business. You'll need a MySQL database that Clockwork can use for storing its data to use the schema correctly. If you're renting from a gameserver provider, you may have a free MySQL database that comes with your server. Otherwise, you'll need to host your own or get it from a web hosting provider. You can use a database from a free database service, but we highly recommend that you do not use them because they tend to be unreliable, and your data may be wiped at any time without notice.
The configuration data is located in /garrysmod/gamemodes/clockwork in a file called clockwork.cfg. The clockwork.cfg file should already have some entries in it, you'll just need to replace the values with your own. It is important to note that every setting must be prefixed with force, and there must be a semicolon at the end of every line that sets a value. Anything prefixed with will be completely disregarded and treated as a comment. Any values that you are going to specify must be underneath a section, which is labelled by text in between square brackets. For example, [MySQL] for the MySQL configuration section.
Now that you've gotten your MySQL database set up and ready to have data slapped into it, you can start inputting the MySQL configuration in the Clockwork configuration file. Note: You do not need the MySQL tables to import into your database - Clockwork will automatically set this up for you. The mysql_host entry in your configuration must be an IP address, not a domain. The name for the MySQL section is [MySQL]. Below is a table of each available setting for this section.
\ mysql_characters_table \ mysql_players_table \ mysql_username \ mysql_password \ mysql_database \ mysql_host \ mysql_port \
Example MySQL Configuration
\ [MySQL] \ force mysql_characters_table = characters; \ force mysql_players_table = players; \ force mysql_username = Impulse; \ force mysql_password = beepbeep; \ force mysql_database = gmod_clockwork; \ force mysql_host = 127.0.0.1; \
Setting up MySQL on cPanel
- Login to your cPanel Account.
- Click the “MYSQL Wizard” and follow the steps, Making note of the database name,username,password. It is recommended that you select all privileges on the similar step Privileges - At the end you will be told the username and database. Some hosts show you the remote ip (Shown in orange in the image) End Of Wizard - If your mysql database is on the same server as your gameserver(Most cases they are not if you are using seperate webhosting) you will need to enter the % symbol, this is so you can tell cPanel that said remote host can access your databases.
- Now fill in the mysql configuration file on your gameserver with the information you wrote down in step 2
Clockwork will automatically create the tables for you
Setting up MYSQL on a local system
A local server is a SteamCMD server on your pc not a server provided by a GSP
- Start by downloading your Garry's Mod server via steamCMD - Gmod Wiki Article
- Follow the installation guide for Clockwork
- Download WAMP This lets us configure MYSQL and gives you a PhpMyAdmin interface
- Now WAMP is setup, start the WAMP server and you should see a icon, It should be green if it isn't click the icon then click start.
- Now click the PhpMyAdmin label, this should open your web browser, and see something similar to the image 2. The username will be “ root ” and the password will be blank.
- Once logged in, click the user's button located at the top then add user below the list.
- Fill in the fields, and generate or create a password. Keep host as localhost or 127.0.0.1 . Note: Make sure you select localhost in the dropdown next to the host field When you reach the next section, tick Create database with same name and grant all privileges
- This has now created a database and a user for you. You should fill in your clockwork.cfg with the information you just created.
Since there are no ways of setting the rank of a player through the console for security reasons, you'll have to edit a section in the clockwork.cfg file. You'll have to find out your (or another person's, if you so wish) Steam ID. You can do this by using an online service to get your Steam ID by your Steam community URL - such as Steam ID Finder, or in-game using the status command in console. This sets the given Steam ID to a super admin every time your server starts or changes level. The name for the owner section is [Owner]. Below is a table of available values for this section.
|Setting||Description||owner_steamid||The Steam ID of the server owner.|
Example Owner Configuration
\\ [Owner]\\ force owner_steamid = STEAM_0:1:12345678;\\