Skip to content

Getting Started

danx91 edited this page Jul 28, 2024 · 11 revisions

Getting Started

Short guide how to start editing this addon.

Requirements

In the first place you have to know LUA, I'm not joking you have to know it to understand what's going on. Without enough knowledge you won't be able to do anything. You can try copy-pasting code to make what you want, but you will eventually make mistake and you will not know how to fix it and most likely no one will fix your mistakes for you.

Sorce code

First of all you have to have source code of this gamemode - download it from GitHub or unpack workshop addon. Create new directory in addons folder and then put there source code of gamemode (e.g. steamapps/common/GarrysMod/garrysmod/addons/scplc/). And remember to DISABLE workshop version of the gamemode!

Editor

Use your favorite editor, but I highly suggest you to use editor that support workspaces (like sublime text or VS Code) because it helps a lot. If you want (for some unknown reasons) to stick with Notepad++, you can do it, but it'll make your life harder.

Naming

All files are divided into 4 folders: core, languages, mapconfigs, modules. Each folder is designed to hold different types of files.

  • core - holds library files that don't interact with gamemode directly
  • modules - holds most of gamemode files
  • mapconfigs - holds configuration files for maps
  • languages - holds all languages

All files are automatically included, that means you don't have (and you really shouldn't) use include function.

All files are named after their content, that means player related stuff will most likely be located in files containing player in name.

You shouldn't edit cl_init.lua, sv_init.lua and shared.lua files!

Loading order

  1. Core
  2. Languages
  3. sh_module.lua
  4. cl/sv_module.lua
  5. Modules
  6. Map Config

Order of files inside folder is ascending by name. But if your code is well designed the loading order shouldn't be problem. If it's, you can always delay loading of things in timer.

Adding new simple things

If you want to add few simple things like classes, teams, SCPs and other things that don't required change in core of gamemode, you ca do it without editing gamemode! You can simply create lua files in autorun folder and in these files you can use provided hooks and functions to add your content.

Need help?

You can always look for help in official discord. However, keep in mind that you should know how to write code, because you will most likely not understand anything.

Clone this wiki locally