Installation
This tutorial is for those who want to transfer their gamemode from SA:MP server to open.mp server.
Good news for FCNPC users! The legacy FCNPC plugin has been replaced with the official open.mp NPC component, which provides the same functionality with better performance and native integration. Simply convert your code to the built-in NPC component instead.
Step 1
Download the latest version of open.mp server files from https://github.com/openmultiplayer/open.mp/releases
.png)
open.mp-win-x86.zipWindows Serveropen.mp-linux-x86.tar.gzLinux Serveropen.mp-linux-x86-dynssl.tar.gzLinux Server (Dynamic SSL)
Step 2
Extract the .zip or .tar.gz archive contents on your disk
.png)
- components: open.mp components
- filterscripts: Your server filter script files (side scripts)
- gamemodes: Your server game mode files (main scripts)
- models: Your server custom models (textures .txd .dff)
- plugins: Your server plugin files (legacy plugins)
- qawno: Pawn editor program and your server includes
- scriptfiles: INI files or other stuff.
- bans.json: Ban list file
- config.json: Server configuration file
- omp-server.exe: open.mp server program
- omp-server.pdb: open.mp server debugging file
Step 3
Put your gamemode .pwn file in the gamemodes folder
Step 4
Put required includes (e.g. sscanf2.inc, streamer.inc) in the qawno/include folder
If you are using the YSI-4 includes in your game mode, update to YSI-5.x
Step 5
Put required plugins (e.g. sscanf.dll, streamer.dll) in the plugins folder
If you use the following plugins in table, you must put a version of the plugin that is compatible with omp!
Put the following plugins in the ../components folder, not in the ../plugins folder!
| Plugin | OMP |
|---|---|
| Pawn.CMD | https://github.com/katursis/Pawn.CMD/releases/tag/3.4.0-omp |
| Pawn.RakNet | https://github.com/katursis/Pawn.RakNet/releases/tag/1.6.0-omp |
| sampvoice | https://github.com/AmyrAhmady/sampvoice/releases/tag/v3.1.5-omp |
| discord-connector | https://github.com/maddinat0r/samp-discord-connector/releases/tag/v0.3.6-pre |
| SKY | Use Pawn.RakNet instead |
| YSF | You don't need YSF because open.mp already declared most of the same natives |
| FCNPC | Currently not supported |
Step 6
Open the qawno IDE program located at Server/qawno/qawno.exe
.png)
Step 7
Press CTRL + O then go to the ../gamemodes folder and open your gamemode .pwn file
Step 8
Find
#include <a_samp>
replace with
#include <open.mp>
then press F5 to compile.
Step 9
Open config.json file with Notepad or other IDEs
.png)
Step 10
Edit config.json
.png)
Find
"main_scripts": [
"gungame 1"
],
replace with
"main_scripts": [
"your_gamemode_amx_file_name 1"
],
Find
"legacy_plugins": [],
Specify required plugins
"legacy_plugins": [
"crashdetect",
"mysql",
"sscanf",
"streamer",
"PawnPlus",
"pawn-memory"
],
Find
"side_scripts": []
Specify your filterscripts
"side_scripts": [
"filterscripts/file_name"
]
Find
"rcon": {
"allow_teleport": false,
"enable": false,
"password": "changeme1"
},
Enter strong password for rcon password:
"rcon": {
"allow_teleport": false,
"enable": false,
"password": "151sd80hgse32q1oi0v8dsge166"
},
Press CTRL + S to save changes.
There is a guide on how to convert server.cfg to config.json at https://www.open.mp/docs/server/config.json
Step 11
Run the server
- Windows
Open the omp-server.exe program
.png)
- Linux
./omp-server
Compiler errors and warnings
- warning 213: tag mismatch: expected tag "?", but found none ("_"):
For example:
TogglePlayerControllable(playerid, 1);
// ->
TogglePlayerControllable(playerid, true);
TextDrawFont(textid, 1);
// ->
TextDrawFont(textid, TEXT_DRAW_FONT_1);
GivePlayerWeapon(playerid, 4, 1);
// ->
GivePlayerWeapon(playerid, WEAPON_KNIFE, 1);
But you can ignore it for now:
#define NO_TAGS
#include <open.mp>
// If the warning still occurs
// Use #pragma warning disable 213
- warning 234: function is deprecated (symbol "TextDrawColor") Use `TextDrawColour
Press CTRL + F in qawno and replace all TextDrawColor to TextDrawColour
.png)
Or if you prefer you can use the mixed spellings:
#define MIXED_SPELLINGS
#include <open.mp>
- warning 234: function is deprecated (symbol "GetPlayerPoolSize") This function is broken.
- warning 234: function is deprecated (symbol "GetVehiclePoolSize") This function is broken.
- warning 234: function is deprecated (symbol "GetActorPoolSize") This function is broken.
Replace GetPlayerPoolSize() with MAX_PLAYERS
Replace GetVehiclePoolSize() with MAX_VEHICLES
Replace GetActorPoolSize() with MAX_ACTORS
- warning 234: function is deprecated (symbol "SHA256_PassHash") Use BCrypt for hashing passwords
Use the samp-bcrypt plugin for hashing passwords. SHA-256 is not secure.
- warning 214: possibly a "const" array argument was intended: "?"
- warning 239: literal array/string passed to a non-const parameter
For example:
public MyFunction(string[])
// ->
public MyFunction(const string[])
- error 025: function heading differs from prototype
For example:
public OnPlayerDeath(playerid, killerid, reason)
// ->
public OnPlayerDeath(playerid, killerid, WEAPON:reason)
public OnPlayerEditAttachedObject(playerid, response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
// ->
public OnPlayerEditAttachedObject(playerid, EDIT_RESPONSE:response, index, modelid, boneid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
There is also an upgrade tool that attempts to find old untagged and const-incorrect code and upgrade it.
https://github.com/openmultiplayer/upgrade
Already included in /qawno/upgrader folder.
Runtime errors and warnings
[Info] Couldn't announce legacy network to open.mp list.
[Info] [Server Error] Status: 406
[Info] [Server Error] Message: {"error":"failed to query server: socket read timed out"}
[Info] This won't affect the server's behaviour.
- Your server is not accessible from the open.mp website.
- You are probably running the server locally.
- The firewall has blocked the connection.
This warning will not affect the behavior of the server.
[Warning] Insufficient specifiers given to `format`: "?" < 1
The specifiers are less than the arguments you pass in the format. For example:
new string[32];
new mp[32] = ".MP";
format(string, sizeof(string), "OPEN", mp);
// [Warning] Insufficient specifiers given to `format`: "OPEN" < 1
// Should be:
format(string, sizeof(string), "OPEN%s", mp);
// ^^
Useful documents
Check out the new scripting functions and callbacks: https://www.open.mp/docs/server/omp-functions
If you are completely new to Pawn programming: readme-beginner
If you are an intermediate at Pawn programming: readme-intermediate
If you are an expert at Pawn programming: readme-expert
Blog post: Porting to open.mp
Help
If you still have issues running the server, please join the official open.mp Discord server: https://discord.gg/samp
Ask in #openmp-support channel.