MTA:SA

Start an MTA:SA server, edit mtaserver.conf, upload resources, create an admin account and connect a MySQL database.

An MTA:SA (Multi Theft Auto: San Andreas) server runs in the Apex Cloud game panel like any other game server. This page covers what is specific to MTA:SA. For the panel itself, see Panel access and Console.

Your plan

PlanSlotsRAMDiskCPU
Inicial101 GB5 GB0.5 vCPU
Básico501 GB5 GB1 vCPU
Plus1002 GB10 GB1 vCPU
Pro1502 GB10 GB2 vCPU
Expert2003 GB15 GB2 vCPU
Elite3004 GB25 GB3 vCPU

The server runs from the Docker image ghcr.io/parkervcp/games:mta with the command ./mta-server64 --port {{SERVER_PORT}} --httpport {{SERVER_WEBPORT}} -n. You can see both on the Startup page, see Startup.

Start the server

Open the console

In the game panel, open your server and go to Console. A new server is already installed: Files shows the MTA:SA server files (mods, x64, mta-server64).

Click Start

The console prints the server banner and, when it is ready, Server started and is ready to accept connections!. The Address card at the top shows the address and port players use.

Console of a running MTA:SA server with the Name, Status and Address cards, CPU, memory and disk usage, and the MTA:SA banner showing the server name, server port and maximum players

Connect

In the MTA:SA client, open Quick connect and enter the address and port from the Address card, for example sp-01.apexcloud.cc and 30033. Your own address and port are on the Network page.

On the first start the server creates its settings and runs the default resources (the console reports Resources: 205 loaded, 0 failed and starts the play freeroam gamemode). Anything you set in mtaserver.conf takes effect on the next start.

Ports

The Network page lists the ports of your server. The one with the star is the primary port, the port players connect to.

Network page listing three ports for the same address, with the first port marked as primary and all three locked

The Startup page shows the two variables the panel fills in for you. They are locked, so you cannot change them:

  • Server Webport is the HTTP port players download resources from. In the example it is 22005.
  • Max Players is the slot count of your plan (10 on Inicial).
Startup page of an MTA:SA server with the startup command, the Docker image ghcr.io/parkervcp/games:mta and the locked Server Webport and Max Players variables

Ignore serverport and httpport in mtaserver.conf

The startup command passes the game port and the HTTP port on the command line. The console shows Server port: 30033 even though mtaserver.conf still says <serverport>22003</serverport>. Leave both settings as they are. If you change the file's ports, nothing happens or your players cannot connect. For the ports, see also Network.

Edit mtaserver.conf

The settings file is mods/deathmatch/mtaserver.conf. The server reads this file, not the small mtaserver.conf at the root of the server, which only holds <maxplayers>.

Stop the server

Click Stop in the Console and wait for the status to change to offline. The server reads mtaserver.conf when it starts.

Open the file

Go to Files, open mods, then deathmatch, then click mtaserver.conf.

Change the essentials

  • <servername>: the name shown in the in-game server browser.
  • <password>: if you fill it in, players must type it to connect. Leave it empty for a public server.
  • <maxplayers>: the number of slots. Do not set more than the slots of your plan (see the table above).
  • <owner_email_address>: the contact email of the owner. The console prints WARNING: <owner_email_address> not set while it is empty.
File editor open on mods/deathmatch/mtaserver.conf with the servername line changed to My MTA Server

Save and start

Click Save, go back to the Console and click Start. The banner now shows the new Server name and Maximum players.

Upload and start resources

Resources live in mods/deathmatch/resources. A resource is a folder with a meta.xml file. The folders whose names are in brackets ([gameplay], [managers] and so on) are only categories that group resources.

Upload the resource

Open mods/deathmatch/resources in Files. Click the File upload icon in the toolbar and choose your resource as a .zip file. For many files or large resources use SFTP instead.

Files page open on mods/deathmatch/resources with the File upload icon highlighted in the toolbar and the hello folder and hello.zip in the list

Unarchive it

Click the three dots at the end of the .zip row and choose Unarchive. A folder with the resource name appears next to the zip. Delete the zip afterwards. The zip must contain the resource folder itself, not loose files.

Refresh and start it

In the Console, type the commands below and press Enter after each one:

refresh
start hello

Replace hello with the name of your resource folder. refresh makes the server read the resources folder. start runs the resource. A resource that fails shows the reason in the console.

Console output after the refresh and start hello commands, showing the new resource loaded, 206 resources loaded and the resource started

Make it start with the server

Resources you start by hand stop again when the server restarts. To start one automatically, add a line next to the others at the end of mods/deathmatch/mtaserver.conf, with the server stopped:

<resource src="hello" startup="1" protected="0" />

Create an admin account

An admin account has two parts: the account itself and its permission in the access control list (ACL). Both are done from files and the console.

Create the account

With the server running, type this in the Console:

addaccount myadmin YourStrongPassword

The console answers ACCOUNTS: Console added account 'myadmin'. Use your own name and a strong password.

Add it to the Admin group

Stop the server first, because a running server can overwrite its access control list. Then open mods/deathmatch/acl.xml in Files, find the <group name="Admin"> block and add one line before its closing </group>:

<object name="user.myadmin"></object>

Click Save.

File editor open on acl.xml with the line object name user.myadmin added to the end of the Admin group and the Save button visible

Reload the ACL

Start the server, which loads the ACL. While the server is running, you can also type reloadacl in the Console to reload the file without a restart. The console confirms with reloadacl: ACL successfully reloaded.

Console showing the addaccount command followed by the account added message, and the reloadacl command followed by ACL successfully reloaded

Log in in-game

In the game, open the chat or the F8 console and type login myadmin YourStrongPassword.

Serial authorization

The server protects accounts of the Admin group. The console says Authorized serial account protection is enabled for the ACL group(s): Admin. If you log in with the account from a second computer, the login is blocked until you authorize that serial with the authserial console command. See mtasa.com/authserial.

Connect a MySQL database

Your plan includes MySQL databases. The Databases tab shows how many you can create (0 / 1 on Inicial). See Databases for creating and managing them.

Create the database

Open Databases, click New database, choose the database host, type a name and click Create. Keep Connections From as % so the game server can connect.

Open the credentials

Click the eye icon on the database row. The window shows Host (with the port), Database, Username and Password. Click the eye in the Password field to reveal it.

Viewing window of a MySQL database showing host with port 3306, database name, username, a hidden password, the remote setting and the JDBC connection string

Connect from a resource

Use dbConnect with the values from that window. Host and port go in the second argument, the user and the password are separate arguments:

local db = dbConnect(
    "mysql",
    "dbname=s79_mta;host=sqlnode.apexcloud.cc;port=3306",
    "u79_username",
    "the-password-from-the-panel",
    "share=1"
)

if db then
    outputServerLog("[mydb] connected to MySQL")
else
    outputServerLog("[mydb] connection failed")
end

Start the resource. A working connection prints your message in the console. A WARNING: MYSQL_OPT_RECONNECT is deprecated line before it is harmless.

Console output after restarting a resource that calls dbConnect, showing the connected to MySQL message

Special characters in the password

The panel generates the password and it can contain characters such as @ and .. Copy it with the copy icon instead of typing it. If the console shows Access denied for user, the password or the username was copied wrongly.

Good to know

  • Backups: the Settings page of the Inicial plan shows Backups: No Backups. The backup add-on is not yet on sale. Download your resources and mods/deathmatch/internal.db with SFTP from time to time. See Backups.
  • Restarts: to restart the server every night, use a schedule, see Scheduled tasks.
  • Slots: the slot count belongs to your plan. To get more, see Upgrades.
  • Problems: see Troubleshooting or contact support.