How to Clone
Ayyy, welcome buddy. You've probably just joined the team and are struggling with cloning this repository and have no clue because senior developers obviously won't ever respond to your questions. But don't worry, I've been there too. So here is a quick summary on how you can easily clone this repository and run it on a local listen server.
Method 1: Listen Server (Easy) | Not Recommended
NOTE: Due to x64 branch no longer being supported with updates, this is not recommended anymore as the branch won't have the latest gmod features and fixes
Method 1 is using a listen server, this is very easy as you are using your own Garry's Mod directory as the server itself. This means you don't have to worry about installing addons and such onto the server, all your active subscriptions will show up. Although it isn't accurate to production, this is usually fine for a dev enviroment and much easier to quickly test with. It is important to remember this isn't accurate to a production enviroment, which may result in weird bugs or issues in rare cases.
Before you start
You want to make sure you have the following Access to gamemode repo: https://github.com/FearlessGaming/CityRP
1. Initial clone
The first thing you want to do is cloning the repository. You want to make sure to clone it to
garrysmod/gamemodes/cityrp/
in your Garry's Mod folder, so that the cityrp.txt
in the root
of the repository is located at garrysmod/gamemodes/cityrp/cityrp.txt
. Please double check the path, as otherwise it won't show up!
2. Install MySQLOO (Optional)
The next thing you need is having MySQLOO installed. Ideally
you should be able to identify what version (Linux/Windows, 32-bit/64-bit) you need, but if you
have no clue, you can just download all files. Note that the downloaded .dll
files must be placed
in the .../garrysmod/lua/bin
folder. If the bin
folder does not exist already, just simply create it.
This step is actually now optional, if you don't have MySQLoo installed it'll automatically fall back to SQLite. I still heavily recommend setting up MySQLOO though, as this gives you greater control over the DB and is more accurate to the enviroment on main. It also will create everything for you automatically, no more importing SQL files!
sqlite fucking breaks to shit because you can't modify tables. don't fucking do it. -internet
3. ServerSide Configuration
Next thing you'll need is the server-side configuration file (sv_configuration.lua
). Here is a template you can use:
cityrpserver = cityrpserver or {}; -- DB info config, change these to your configuration cityrpserver["MySQL Host"] = "host-here"; -- The host that your MySQL database is located. cityrpserver["MySQL Username"] = "username-here"; -- The username that you log into MySQL with. cityrpserver["MySQL Password"] = "password-here"; -- The password that you log into MySQL with. cityrpserver["MySQL Port"] = 3306; -- The port of the database that we'll be using. -- Special dev options cityrpserver["DisablePrecache"] = true; -- This speeds up loading time, useful for development! -- Don't touch below here unless you know what you're doing, the defaults work fine. cityrpserver["MySQL Database"] = "fearless_cityrp"; -- The name of the database that we'll be using. cityrpserver["MySQL Table"] = "players"; -- The name of the table where the player data is stored. cityrpserver["MySQL Access Log Table"] = "accesslog"; -- Table for access and blacklist logs. cityrpserver["MySQL Online Log Table"] = "onlinelog"; -- Table for access and blacklist logs. cityrpserver["MySQL Log Table"] = "logs"; -- Table for all logs cityrpserver["MySQL Chat Table"] = "chat"; -- Table for networked chat cityrpserver["MySQL RPP Table"] = "rppoints"; -- Table where reasons for RP points are stored
All you need to do is give it valid credentials, it'll automatically create the DB using the migration system. We do have a dev DB that you can use if you're lazy, contact a developer for details. I do recommend setting up your own for greater control and accuracy though.
Once filled in, you will then need to copy the file to %REPO_ROOT%/gamemode/core/sv_configuration.lua
.
Don't worry, the file is ignored by Git, so it won't cause any conflicts.
4. Set up vehicle scripts
If you're doing anything vehicle related, you will want to copy the scripts folder over to your game directory. I don't recommend doing a symlink, as this is your regular gmod folder and you will likely have other scripts and gamemodes.
You want to copy the contents of %REPO_ROOT%/scripts
into %STEAM_COMMON%/GarrysMod/garrysmod/scripts
.
If the scripts folder doesn't exist in your garrysmod directory, create it or just copy the entire folder.
5. Running
Now you're ready to run the gamemode locally! To do so, restart your game if you haven't done already. Then in the main menu:
Click "Start Singleplayer Game". Select the FL CityRP gamemode in the bottom right corner. Select multiplayer, with at least 8 players. Select a cool map (maybe an RP based map) Make sure to NOT select "Singleplayer" or "Peer-to-Peer". Instead, select "Local Server". Have fun!
Method 2: Dedicated Server (Moderate) | Recommended
NOTE: The x64 branch is no longer supported, you should use the default or "dev" 32 bit branch for your dedicated server
If you're going to be working on the gamemode for a while, or may work on different complex branches, you should set up a dedicated server. This is more effort than a listen server, however, that effort is one-time and the result is a significantly more accurate dev enviroment.
The Garry's Mod wiki has a nice page on how to set up a dedicated server for Garry's Mod: https://wiki.facepunch.com/gmod/Downloading_a_Dedicated_Server You should use this workshop collection on the server (same as prod): https://steamcommunity.com/sharedfiles/filedetails/?id=2824995698 Note: If you have unique content required for your changes, you'll likely need to copy the collection above and add your own stuff (recommended) or manually add it (not recommended).
1. Initial clone
Once you've set up the dedicated server, there's two repos you will need to clone. CityRP Gamemode: https://github.com/FearlessGaming/CityRP CityRP Addons: https://github.com/FearlessGaming/FearlessAddons
The steps for the gamemode are identical to the steps for a listen server.
Gamemode
You want to clone the gamemode to .../garrysmod/gamemodes/cityrp/
in your Garry's Mod folder, so that the file cityrp.txt
in the root
of the repository is located at .../garrysmod/gamemodes/cityrp/cityrp.txt
. Please double check the path, as otherwise it won't show up!
Note: Sometimes cloning may create a new folder, so please do check to make sure the path is correct. You can clone elsewhere and copy the contents into
.../garrysmod/gamemodes/cityrp/
if it's easier. As long as the .git folder is moved, it won't matter.
The gamemode will need further configuration to work, so see below!
Addons
For addons, you want to clone it into .../garrysmod/addons
, so that the file .gitattributes
in the root of the repository is located at
.../garrysmod/addons/.gitattributes
.
Note: Sometimes cloning may create a new folder, so please do check to make sure the path is correct. You can clone elsewhere and copy the contents into
.../garrysmod/addons
if it's easier. As long as the .git folder is moved, it won't matter.
Once done, your addons are all set up! You'll just need to complete the gamemode stuff.
If the thing you're working on requires new content, I recommend copying the public workshop collection (make your own collection and add everything in it). It's a bit of effort, but it's worth it as it makes adding or testing new content significantly easier. We don't have that many addons anyway, much less than before.
2. Install MySQLOO
The next thing you need is having MySQLOO installed. Ideally
you should be able to identify what version (Linux/Windows, 32-bit/64-bit) you need, but if you
have no clue, you can just download all files. Note that the downloaded .dll
files must be placed
in the .../garrysmod/lua/bin
folder. If the bin
folder does not exist already, just simply create it.
Note: You don't have to import any SQL files, the migrations system will create all the tables for you if they don't exist!
2a. Install Optional Modules
Some modules provide additional, optional functionality, which can be useful while developing.
- enginespew is used to hide some false errors and format others.
3. ServerSide Configuration
Next thing you'll need is the server-side configuration file (sv_configuration.lua
). Here is a template you can use:
cityrpserver = cityrpserver or {}; -- DB info config, change these to your configuration cityrpserver["MySQL Host"] = "host-here"; -- The host that your MySQL database is located. cityrpserver["MySQL Username"] = "username-here"; -- The username that you log into MySQL with. cityrpserver["MySQL Password"] = "password-here"; -- The password that you log into MySQL with. cityrpserver["MySQL Port"] = 3306; -- The port of the database that we'll be using. -- Special dev options cityrpserver["DisablePrecache"] = true; -- This speeds up loading time, useful for development! -- Don't touch below here unless you know what you're doing, the defaults work fine. cityrpserver["MySQL Database"] = "fearless_cityrp"; -- The name of the database that we'll be using. cityrpserver["MySQL Table"] = "players"; -- The name of the table where the player data is stored. cityrpserver["MySQL Access Log Table"] = "accesslog"; -- Table for access and blacklist logs. cityrpserver["MySQL Online Log Table"] = "onlinelog"; -- Table for access and blacklist logs. cityrpserver["MySQL Log Table"] = "logs"; -- Table for all logs cityrpserver["MySQL Chat Table"] = "chat"; -- Table for networked chat cityrpserver["MySQL RPP Table"] = "rppoints"; -- Table where reasons for RP points are stored
All you need to do is give it valid credentials, it'll automatically create the DB using the migration system. We do have a dev DB that you can use if you're lazy, contact a developer for details. I do recommend setting up your own for greater control and accuracy though.
Once filled in, you will then need to copy the file to `.../garrysmod/gamemode/core/sv_configuration.lua
.
Don't worry, the file is ignored by Git, so it won't cause any conflicts.
4. Set up vehicle scripts
For a dedicated server, I highly recommend setting up a symlink that'll tell windows to look in your gamemode folder for scripts. This means you won't ever have to update it again, pulling from the repo will automatically update scripts in your base gmod directory. Since this is a dedicated server, you don't have to worry about overwriting scripts as this is just for FL development anyway.
You have two options for how to get vehicle scripts working
Option 1: Symlink (Recommended)
First, make note of both the gamemode scripts directory. This should be:
GAMEMODE: .../garrysmod/gamemodes/cityrp/scripts
But it may vary depending on your setup
If the scripts folder in your base Garry's Mod already exists, delete it. It is located at:
.../garrysmod/scripts
**.../garrysmod/scripts
must not exist for the symlink to work**
First, you want to open command prompt as an administrator (might not work otherwise).
Once open, navigate to your Garry's Mod directory using cd
.
If you're not sure how to do this:
- Using windows explorer, go to your .../garrysmod/
folders
- Click on the address bar and copy it all
- Go to your command prompt, and type in cd
then paste
- On the left, you should see the directory followed by >
. This means you're in this directory!
The command we're going to use to do this is mklink /J Link Target
mklink
is the command for making a symlink (somewhat self explanatory)
/J
means we want to make a hard directory link, also known as a junction link.
Link
is the name of the folder to create
Target
to where to point to
Note: If there's any spaces in your directory links, put quotes around them.
With your command prompt at .../garrysmod/
, input the following:
mklink /J "scripts" "gamemodes/cityrp/scripts"
If successful, you should see
Junction created for scripts <<===>> gamemodes/cityrp/scripts
Now your Garry's Mod server will think the scripts folder is within the gamemode, so it'll search in there for scripts automatically on boot.
Option 2: Copy files
Sometimes you might just want to copy them over yourself, maybe this is a temp setup or the symlink doesn't work
You want to copy the contents of .../garrysmod/gamemodes/cityrp/scripts
into .../garrysmod/scripts
.
If the scripts folder doesn't exist in your garrysmod directory, create it or just copy the entire folder.
5. Running
Everything is almost ready!
You'll likely want to create a quick .bat script to start the server, for example:
srcds.exe +maxplayers 20 -console +gamemode cityrp -port 27015 +host_workshop_collection 2824995698 +map rp_evocity_v4b1_fl -tickrate 22 -disableluarefresh +sv_setsteamaccount <your token>
Place this where srcds.exe is, likely in the garrysmod folder.
You also may want to create a script to automatically update Garry's Mod, for example:
Place this in your root dedicated server directory, where steamcmd.exe is.
Remember to set your +sv_setsteamaccount
with your GSLT token, more information here: https://wiki.facepunch.com/gmod/SteamGameServerAccounts
You also likely want to set a password, alongside other config options, in svconfigura
Once done, simply run the .bat script and you should see the server start to launch. You can type status in the console to get the IP of the server once it is done starting up.