-
Notifications
You must be signed in to change notification settings - Fork 32
Servers Quickstart
Running a SA:MP server can be a time-consuming process behind-the-scenes. Making
sure the configuration and environment is correct is vital to success. The
server.cfg
file can get messy on larger projects and it's not a standardised
format so there aren't tools to validate it.
sampctl provides a tool to "compile" a more developer-friendly JSON or YAML
"Runtime Configuration" to a server.cfg
file so you never have to worry about it again!
On top of that, sampctl can handle running the server for you and it will even make sure it restarts when it crashes (without getting into a crash loop). It can also download the necessary server binary files for your platform (server, npc and announce files) so you'll never have to unzip them again!
If you're either starting a new project or have an existing project, cd
into
the project directory and run:
sampctl server init
You will then be asked a series of questions about your gamemode, some information will be inferred from the existing setup.
After that, there will be a samp.json
or samp.yaml
file in the directory.
This is your new method of configuration and every time you run the server, this
file will be used to generate a server.cfg
.
- This directory is now known as a "runtime"
- The
samp.json
/samp.yaml
file is a "runtime config"
A runtime can be "ensured" which means sampctl will make sure everything is set up correctly in order to run the server. You can either use
sampctl server ensure
to trigger the "ensure" process.
So, now you've got set up, your config may look like this:
{
"gamemodes": ["cnr"],
"plugins": ["crashdetect", "sscanf", "streamer"],
"port": 7777,
"hostname": "My Awesome Server",
"maxplayers": 32,
"rcon": false,
"rcon_password": "test"
}
Lets say you want to keep your plugins up to date. The old way of doing this would be to watch the forum or GitHub for new releases and when there is one, download the new binaries, upload them to your VPS or place them in your local dev folder.
With sampctl, you simply just replace your entries in plugins
with GitHub
username/repository
syntax:
{
"gamemodes": ["cnr"],
"plugins": [
"Zeex/samp-plugin-crashdetect",
"maddinat0r/sscanf",
"samp-incognito/samp-streamer-plugin"
],
"port": 7777,
"hostname": "My Awesome Server",
"maxplayers": 32,
"rcon": false,
"rcon_password": "test"
}
Now if you run sampctl server ensure
, these three plugins will be
automatically downloaded and installed to the plugins
directory.
Don't worry about adding .so
for Linux and leaving it out for Windows, sampctl
handles that automatically!
You now know the basics of sampctl server management. There are plenty more
features so explore this wiki or type --help
after any sampctl
command.
You can learn more about the Runtime Configuration here.