Controlling a Server
Changing Gamemode
Running a custom/downloaded gamemode
- Open the directory you installed the server to (eg: /Rockstar Games/GTA San Andreas/server)
- Take the downloaded/compiled .amx file and place it in the gamemodes folder where you installed the server
- Use RCON to change the mode.
- Alternatively you can add the new mode to a rotation.
Using Filterscripts
The same as running a custom gamemode, except:
- Place the .amx in a folder called
filterscripts - Add the filterscript path without the
.amxextension topawn.side_scriptsin config.json:
{
"pawn": {
"side_scripts": [
"filterscripts/scriptname"
]
}
}
Passwording your server
- If you want to add a password so only your friends can join, add this to config.json:
{
"password": "whatever"
}
- This will make your server password-protected with the password set as 'whatever' - change it to whatever you want.
- You can also change the password while ingame by using
/rcon password newpasswordhere - You can remove the password by using
/rcon password 0, or by restarting the server.
Using RCON
Logging In
You can log in either while ingame by typing /rcon login password or out of game by using the RCON mode in the Remote Console.
Use the rcon.password value from config.json when logging in.
Adding Bans
A ban prevents an IP address from connecting to the server.
bans.json
bans.json is the file used for storing bans, including the following information about the ban:
- IP
- Date
- Time
- Name (Name of person)
- Reason (see BanEx)
To add a ban, simply add an object to the JSON array like so:
[
{"address": "IP_HERE", "player": "PLAYER", "reason": "BAN REASON", "time": "2009-05-28T13:37:00+0000"}
]
Where IP_HERE is, is where you put the IP you would like to ban. This method takes longer than the RCON banip command, so using banip is recommended.
Ban() function
The Ban function can be used to ban a player from a script. The BanEx function will add an optional reason like so:
[
{"address": "13.37.13.37", "player": "Cheater", "reason": "INGAME BAN", "time": "2009-05-28T13:37:00+0000"}
]
RCON ban command
The RCON ban command, executed by typing /rcon ban in-game or typing "ban" in the console, is used to ban a specific player that is on your server, to ban an IP see the next section.
Simply type:
# Ingame:
/rcon ban PLAYERID
# Console:
ban PLAYERID
banip
The RCON banip command, executed by typing /rcon banip in-game or typing "banip" in the console, is used to ban a specific IP address, to ban a player on your server by ID, see the previous section. Will accept wildcards for rangebans.
Simply type:
# Ingame:
/rcon banip IP
# Console:
banip IP
Removing Bans
Once somebody is banned, there are two ways to unban them.
- Remove from bans.json
- The RCON
unbanipcommand
bans.json
bans.json can be found in your open.mp server directory, it contains objects with the following information about each ban:
- IP
- Date
- Time
- Name (Name of person)
- Reason (see BanEx)
Examples:
[
{"address": "127.8.57.32", "player": "NONE", "reason": "IP BAN", "time": "2009-06-13T13:37:00+0000"},
{"address": "13.37.13.37", "player": "Kyeman", "reason": "INGAME BAN", "time": "2009-05-28T13:37:00+0000"}
]
To unban them, simply remove the object, then execute the RCON reloadbans command to make the server re-read bans.json.
unbanip
The RCON unbanip command can be used in-game or from the server console (black box). To unban an ip, simply type /rcon unbanip IP_HERE in-game or unbanip IP_HERE in the console.
Example:
[
{"address": "13.37.13.37", "player": "Kyeman", "reason": "INGAME BAN", "time": "2009-05-28T13:37:00+0000"}
]
# Ingame:
/rcon unbanip 13.37.13.37
# Console
unbanip 13.37.13.37
To unban them, simply use the unbanip command.
reloadbans
bans.json is a file that holds the information for the IP's that are currently banned from the server. This file is read when the server is started, so if you unban an IP/person by editing the file you MUST type the RCON reloadbans command to make the server read bans.json again and allow them to join the server.
RCON Commands
Type cmdlist for commands (or, varlist for variables) making use of the RCON in-game (/rcon cmdlist).
You do not need to type the [ ] brackets; they are just there to highlight the parameter.
These are the functions that you as admin can use:
| Command | Description |
|---|---|
/rcon cmdlist | Shows a list with commands. |
/rcon varlist | Shows a list with the current variables. |
/rcon exit | Closes the server. |
/rcon echo [text] | Shows the [text] in the console of the server (NOT the client-console in-game). |
/rcon hostname [name] | change the hostname text (example: /rcon hostname my server). |
/rcon gamemodetext [name] | change the gamemode text (example: /rcon gamemodetext my gamemode). |
/rcon mapname [name] | change the map name text (example: /rcon mapname San Andreas). |
/rcon exec [filename] | Executes the file which contains server cfg (example: /rcon exec blah.cfg). |
/rcon kick [ID] | Kick the player with the given ID (example: /rcon kick 2). |
/rcon ban [ID] | Ban the player with the given ID (example: /rcon ban 2). |
/rcon changemode [mode] | This command will change the current gamemode to the given one (example: if you want to play sftdm: /rcon changemode sftdm). |
/rcon gmx | Will load the next gamemode in config.json. |
/rcon reloadbans | Reloads the bans.json file where the banned IP addresses are stored. Should be used after unbanning and IP address by editing the file. |
/rcon reloadlog | Reloads the log.txt. Useful for automatic log rotation. Can be triggered by sending the SIGUSR1 signal to the server (Linux server only). |
/rcon say | shows a message to the players in the client-console (example: /rcon say hello will show as Admin: hello). |
/rcon players | Shows the players that are in the server (with their name, IP & ping). |
/rcon banip [IP] | Ban the given IP (example: /rcon banip 127.0.0.1). |
/rcon unbanip [IP] | Unban the given IP (example: /rcon unbanip 127.0.0.1). |
/rcon gravity | Changes the gravity (example: /rcon gravity 0.008). |
/rcon weather [ID] | Changes the weather (example: /rcon weather 1). |
/rcon loadfs | Loads the given filterscript (example: /rcon loadfs adminfs). |
/rcon weburl [server url] | Changes the server URL in the masterlists/SA-MP client |
/rcon unloadfs | Unload the given filterscript (example: /rcon unloadfs adminfs). |
/rcon reloadfs | Reloads the given filterscript (example: /rcon reloadfs adminfs). |
/rcon rcon\_password [PASSWORD] | Change the rcon's password |
/rcon password [password] | Sets/resets the server password |
/rcon messageslimit [count] | Change the number of messages per second a client sends to the server. (default 500) |
/rcon ackslimit [count] | Change the limit of acks (default 3000) |
/rcon messageholelimit [count] | Change the limit of message holes (default 3000) |
/rcon playertimeout [limit m/s] | Change the time in milliseconds until a player timeouts when not sending any packets. (default 1000) |
/rcon language [language] | Change the server language (example: /rcon language English). Shown in server browser. |
The above four limits/counts are just made to avoid several tools which can attack any SA-MP server by freezing it or crashing. So, simply, just set them according to your server. The default values are default, if you see any wrong kicks, just increase the values as soon as possible so that the innocent players won't get kicked by it.
Related Callbacks and Functions
The following callbacks and functions might be useful, as they're related to this article in one way or another.
Callbacks
- OnRconLoginAttempt: Called when an attempt to login to RCON is made.
Functions
-
IsPlayerAdmin: Checks if a player is logged into RCON.
-
SendRconCommand: Sends an RCON command via the script.