Run your own SA-MP gamemode: filterscripts, plugins and MySQL

Upload your own SA-MP gamemode to a free Torchlite server: .amx files, filterscripts, Linux .so plugins, server.cfg, a MySQL database for your accounts and the errors you will meet.

4 min readBy Torchlite teamUpdated

Run your own SA-MP gamemode: filterscripts, plugins and MySQL
On this page

A new SA-MP server on Torchlite starts with the default gamemode so you can join straight away. Most communities run their own: a roleplay, freeroam, stunt or deathmatch gamemode written in Pawn, with filterscripts next to it and a few plugins such as sscanf, streamer or MySQL. This guide moves your own gamemode onto the server, step by step, and connects it to the MySQL database every Torchlite server comes with.

Everything here also works on an open.mp server with a SA-MP gamemode, with one difference covered at the end.

What you need

  • Your gamemode compiled to an .amx file. If you only have the .pwn source, compile it first with the Pawn compiler (pawno, or Qawno for open.mp) on your computer.
  • The .amx files of your filterscripts.
  • The Linux build of every plugin your gamemode uses. A plugin is a .dll on Windows and a .so on Linux, and the server here runs on Linux, so only the .so files load.
  • An SFTP client such as FileZilla or WinSCP for larger uploads. The SFTP guide shows how to connect.

Stop the server before you start, so nothing is writing to the files while you replace them.

Upload the files

Open Files in the panel, or connect over SFTP, and put each file in its folder:

WhatFolderExample
Gamemodegamemodesgamemodes/myrp.amx
Filterscriptsfilterscriptsfilterscripts/admin.amx
Pluginspluginsplugins/sscanf.so
Data your scripts read and writescriptfilesscriptfiles/users/

Upload the compiled .amx files, not the .pwn sources: the server cannot compile code.

Point server.cfg at them

Open server.cfg in Files. These are the lines that matter:

text
gamemode0 myrp 1
filterscripts admin anticheat
plugins sscanf.so streamer.so mysql.so
maxplayers 50
hostname My Roleplay Server
  • gamemode0 is the file name without .amx, followed by how many times it repeats before the next gamemode, 1 for a single gamemode.
  • filterscripts lists filterscript names without .amx, separated by spaces.
  • plugins lists the plugin files with .so, in the order they must load. Put sscanf and streamer before plugins that depend on them.
  • maxplayers is how many players can join at once.

Leave the port line as it is: the panel writes it on every start. The rcon_password line is the server's admin password; keep it secret, or set a new one under RCON password on the Startup page.

Save, then press Start and watch the console. A good start lists each plugin as loaded and ends with your gamemode's own start-up messages.

Connect your gamemode to MySQL

Roleplay gamemodes usually keep accounts, houses and vehicles in a MySQL database. Every Torchlite server can have one, at no cost:

  1. In the panel, open Databases and click New Database. Give it a name and leave Connections from at %.
  2. Open the new database to see its Database Details: the Endpoint (host and port, such as mysql.torchlite.host:3306), the username and the password, next to the database name. Click a value to copy it.
  3. Put those four values where your gamemode reads its MySQL settings. Many gamemodes keep them in a few #define lines or in a file in scriptfiles; with the MySQL plugin the connection is opened with mysql_connect(host, user, password, database).
  4. Most gamemodes ship a .sql file that creates their tables. Import it with any MySQL client on your computer, such as HeidiSQL or DBeaver, connected to the same endpoint.

Use the host exactly as the panel shows it. localhost does not work: the database runs on a separate database server, not inside your game server. The MySQL guide covers creating the database in more detail.

Keep it running

A free server runs while you renew it in the panel, every 50 minutes on Lite and 40 on Turbo. A roleplay community usually wants the server up for a few hours each evening; keep the panel open in a tab and press Renew when it asks. If you miss it, the server stops and nothing is lost; press Start and it loads the same gamemode again. The renewal guide has every rule.

Take a backup before big gamemode updates, and keep your .pwn sources on your own computer or on GitHub, not only on the server.

open.mp servers

An open.mp server runs SA-MP gamemodes too, and most SA-MP plugins load on it unchanged. Its settings live in config.json instead of server.cfg: the gamemode goes under pawn.main_scripts, filterscripts under pawn.side_scripts and legacy plugins under pawn.legacy_plugins. open.mp also loads its own components from the components folder, which replace some old plugins.

Common problems

"Failed to load plugin" in the console

The file is the Windows .dll, or the plugin needs a system library the server does not have. Download the Linux .so release of the plugin; for plugins that depend on extra libraries, pick a release that bundles them.

The server stops right after "Loading gamemode"

The gamemode file name in gamemode0 does not match a file in gamemodes, or the gamemode calls a native from a plugin that did not load. Read the lines just above the stop: the missing native or file is named there.

"Could not connect to MySQL"

The host, user, password or database name does not match the Databases page, or the gamemode uses localhost. Copy the four values again from the panel.

Players see "Server didn't respond"

The server is still starting, or it stopped because the renew timer ran out. Check the console, press Start if needed, and connect with the address shown at the top of your server's page.

Stuck on a step?

Ask on the forum. Your question links back to this guide, so whoever answers knows where you are.

Ask about this guide

About the author

Torchlite team

The people who run Torchlite

We build and run the Torchlite panel and the nodes. Every guide is checked on our own servers before it goes up, and updated when the panel changes.

Found a mistake? Tell us on Discord

Related guides

All guides →