|
| 1 | +**This tutorial is for those who want to transfer their gamemode from SA:MP server to open.mp server.** |
| 2 | + |
| 3 | +:::note |
| 4 | + |
| 5 | +*If you are using the FCNPC plugin, please stop for now because this plugin does not work for open.mp currently.* |
| 6 | + |
| 7 | +::: |
| 8 | + |
| 9 | +## Contents |
| 10 | + |
| 11 | +- [Step 1](#step-1) |
| 12 | +- [Step 2](#step-2) |
| 13 | +- [Step 3](#step-3) |
| 14 | +- [Step 4](#step-4) |
| 15 | +- [Step 5](#step-5) |
| 16 | +- [Step 6](#step-6) |
| 17 | +- [Step 7](#step-7) |
| 18 | +- [Step 8](#step-8) |
| 19 | +- [Step 9](#step-9) |
| 20 | +- [Step 10](#step-10) |
| 21 | +- [Step 11](#step-11) |
| 22 | +- [Compiler errors and warnings](#compiler-errors-and-warnings) |
| 23 | +- [Runtime errors and warnings](#runtime-errors-and-warnings) |
| 24 | +- [Useful documents](#useful-documents) |
| 25 | +- [Help](#help) |
| 26 | + |
| 27 | +## Step 1 |
| 28 | + |
| 29 | +Download the latest version of open.mp server files from [https://github.com/openmultiplayer/open.mp/releases](https://github.com/openmultiplayer/open.mp/releases/latest) |
| 30 | + |
| 31 | +<kbd>.png)</kbd> |
| 32 | + |
| 33 | +- `open.mp-win-x86.zip` **Windows** Server |
| 34 | +- `open.mp-linux-x86.tar.gz` **Linux** Server |
| 35 | +- `open.mp-linux-x86-dynssl.tar.gz` **Linux** Server (Dynamic SSL) |
| 36 | + |
| 37 | +## Step 2 |
| 38 | + |
| 39 | +Extract the `.zip` or `.tar.gz` archive contents on your disk |
| 40 | + |
| 41 | +<kbd>.png)</kbd> |
| 42 | + |
| 43 | +:::note |
| 44 | + |
| 45 | +- **components:** open.mp components |
| 46 | +- **filterscripts:** Your server filter script files (side scripts) |
| 47 | +- **gamemodes:** Your server game mode files (main scripts) |
| 48 | +- **models:** Your server custom models (textures .txd .dff) |
| 49 | +- **plugins:** Your server plugin files (legacy plugins) |
| 50 | +- **qawno:** Pawn editor program and your server includes |
| 51 | +- **scriptfiles:** INI files or other stuff. |
| 52 | +- **bans.json:** Ban list file |
| 53 | +- **config.json:** Server configuration file |
| 54 | +- **omp-server.exe:** open.mp server program |
| 55 | +- **omp-server.pdb:** open.mp server debugging file |
| 56 | + |
| 57 | +::: |
| 58 | + |
| 59 | +## Step 3 |
| 60 | + |
| 61 | +Put your gamemode `.pwn` file in the **gamemodes** folder |
| 62 | + |
| 63 | +## Step 4 |
| 64 | + |
| 65 | +Put required includes (e.g. `sscanf2.inc`, `streamer.inc`) in the **qawno/include** folder |
| 66 | + |
| 67 | +:::note |
| 68 | + |
| 69 | +If you are using the YSI-4 includes in your game mode, update to [YSI-5.x](https://github.com/pawn-lang/YSI-Includes/releases) |
| 70 | + |
| 71 | +::: |
| 72 | + |
| 73 | +## Step 5 |
| 74 | + |
| 75 | +Put required plugins (e.g. `sscanf.dll`, `streamer.dll`) in the **plugins** folder |
| 76 | + |
| 77 | +<hr /> |
| 78 | + |
| 79 | +:::warning |
| 80 | + |
| 81 | +If you use the following plugins in table, you must put a version of the plugin that is compatible with omp! |
| 82 | + |
| 83 | +Put the following plugins in the **../components** folder, not in the **../plugins** folder! |
| 84 | + |
| 85 | +::: |
| 86 | + |
| 87 | +| Plugin | OMP | |
| 88 | +|-------------------|------------------------------------------------------------------------------| |
| 89 | +| Pawn.CMD | https://github.com/katursis/Pawn.CMD/releases/tag/3.4.0-omp | |
| 90 | +| Pawn.RakNet | https://github.com/katursis/Pawn.RakNet/releases/tag/1.6.0-omp | |
| 91 | +| sampvoice | https://github.com/AmyrAhmady/sampvoice/releases/tag/v3.1.5-omp | |
| 92 | +| discord-connector | https://github.com/maddinat0r/samp-discord-connector/releases/tag/v0.3.6-pre | |
| 93 | +| SKY | Use Pawn.RakNet instead | |
| 94 | +| YSF | You don't need YSF because open.mp already declared most of the same natives | |
| 95 | +| FCNPC | Currently not supported | |
| 96 | + |
| 97 | +## Step 6 |
| 98 | + |
| 99 | +Open the qawno IDE program located at **Server/qawno/qawno.exe** |
| 100 | + |
| 101 | +<kbd>.png)</kbd> |
| 102 | + |
| 103 | +## Step 7 |
| 104 | + |
| 105 | +Press **CTRL + O** then go to the **../gamemodes** folder and open your gamemode `.pwn` file |
| 106 | + |
| 107 | +## Step 8 |
| 108 | + |
| 109 | +Find |
| 110 | +```pawn |
| 111 | +#include <a_samp> |
| 112 | +``` |
| 113 | +replace with |
| 114 | +```pawn |
| 115 | +#include <open.mp> |
| 116 | +``` |
| 117 | +then press **F5** to compile. |
| 118 | + |
| 119 | +:::note |
| 120 | + |
| 121 | +If you are get error or warning, see [Compiler errors and warnings](#compiler-errors-and-warnings) |
| 122 | + |
| 123 | +::: |
| 124 | + |
| 125 | +## Step 9 |
| 126 | + |
| 127 | +Open **[config.json](https://www.open.mp/docs/server/config.json)** file with Notepad or other IDEs |
| 128 | + |
| 129 | +<kbd>.png)</kbd> |
| 130 | + |
| 131 | +## Step 10 |
| 132 | + |
| 133 | +Edit **config.json** |
| 134 | + |
| 135 | +<kbd>.png)</kbd> |
| 136 | + |
| 137 | +Find |
| 138 | +```json |
| 139 | +"main_scripts": [ |
| 140 | + "gungame 1" |
| 141 | +], |
| 142 | +``` |
| 143 | +replace with |
| 144 | +```json |
| 145 | +"main_scripts": [ |
| 146 | + "your_gamemode_amx_file_name 1" |
| 147 | +], |
| 148 | +``` |
| 149 | + |
| 150 | +<hr /> |
| 151 | + |
| 152 | +Find |
| 153 | +```json |
| 154 | +"legacy_plugins": [], |
| 155 | +``` |
| 156 | +Specify required plugins |
| 157 | +```json |
| 158 | +"legacy_plugins": [ |
| 159 | + "crashdetect", |
| 160 | + "mysql", |
| 161 | + "sscanf", |
| 162 | + "streamer", |
| 163 | + "PawnPlus", |
| 164 | + "pawn-memory" |
| 165 | +], |
| 166 | +``` |
| 167 | + |
| 168 | +<hr /> |
| 169 | + |
| 170 | +Find |
| 171 | +```json |
| 172 | +"side_scripts": [] |
| 173 | +``` |
| 174 | +Specify your filterscripts |
| 175 | +```json |
| 176 | +"side_scripts": [ |
| 177 | + "filterscripts/file_name" |
| 178 | +] |
| 179 | +``` |
| 180 | + |
| 181 | +<hr /> |
| 182 | + |
| 183 | +Find |
| 184 | +```json |
| 185 | +"rcon": { |
| 186 | + "allow_teleport": false, |
| 187 | + "enable": false, |
| 188 | + "password": "changeme1" |
| 189 | +}, |
| 190 | +``` |
| 191 | +Enter strong password for rcon password: |
| 192 | +```json |
| 193 | +"rcon": { |
| 194 | + "allow_teleport": false, |
| 195 | + "enable": false, |
| 196 | + "password": "151sd80hgse32q1oi0v8dsge166" |
| 197 | +}, |
| 198 | +``` |
| 199 | + |
| 200 | +Press **CTRL + S** to save changes. |
| 201 | + |
| 202 | +:::tip |
| 203 | + |
| 204 | +There is a guide on how to convert `server.cfg` to `config.json` at https://www.open.mp/docs/server/config.json |
| 205 | + |
| 206 | +::: |
| 207 | + |
| 208 | +## Step 11 |
| 209 | + |
| 210 | +Run the server |
| 211 | + |
| 212 | +- **Windows** |
| 213 | + |
| 214 | +Open the `omp-server.exe` program |
| 215 | + |
| 216 | +<kbd>.png)</kbd> |
| 217 | + |
| 218 | +- **Linux** |
| 219 | + |
| 220 | +```bash |
| 221 | +./omp-server |
| 222 | +``` |
| 223 | + |
| 224 | +## Compiler errors and warnings |
| 225 | +- **warning 213: tag mismatch: expected tag "?", but found none ("_")**: |
| 226 | + |
| 227 | +For example: |
| 228 | + |
| 229 | +```pawn |
| 230 | +TogglePlayerControllable(playerid, 1); |
| 231 | +// -> |
| 232 | +TogglePlayerControllable(playerid, true); |
| 233 | +``` |
| 234 | + |
| 235 | +```pawn |
| 236 | +TextDrawFont(textid, 1); |
| 237 | +// -> |
| 238 | +TextDrawFont(textid, TEXT_DRAW_FONT_1); |
| 239 | +``` |
| 240 | + |
| 241 | + |
| 242 | +```pawn |
| 243 | +GivePlayerWeapon(playerid, 4, 1); |
| 244 | +// -> |
| 245 | +GivePlayerWeapon(playerid, WEAPON_KNIFE, 1); |
| 246 | +``` |
| 247 | + |
| 248 | +But you can ignore it for now: |
| 249 | + |
| 250 | +```pawn |
| 251 | +#define NO_TAGS |
| 252 | +#include <open.mp> |
| 253 | +
|
| 254 | +// If the warning still occurs |
| 255 | +// Use #pragma warning disable 213 |
| 256 | +``` |
| 257 | + |
| 258 | +<hr /> |
| 259 | + |
| 260 | +- **warning 234: function is deprecated (symbol "TextDrawColor") Use `TextDrawColour** |
| 261 | + |
| 262 | +Press **CTRL + F** in qawno and replace all `TextDrawColor` to `TextDrawColour` |
| 263 | + |
| 264 | +<kbd>.png)</kbd> |
| 265 | + |
| 266 | +Or if you prefer you can use the mixed spellings: |
| 267 | + |
| 268 | +```pawn |
| 269 | +#define MIXED_SPELLINGS |
| 270 | +#include <open.mp> |
| 271 | +``` |
| 272 | + |
| 273 | +<hr /> |
| 274 | + |
| 275 | +- **warning 234: function is deprecated (symbol "GetPlayerPoolSize") This function is fundamentally broken.** |
| 276 | +- **warning 234: function is deprecated (symbol "GetVehiclePoolSize") This function is fundamentally broken.** |
| 277 | +- **warning 234: function is deprecated (symbol "GetActorPoolSize") This function is fundamentally broken.** |
| 278 | + |
| 279 | +Replace `GetPlayerPoolSize()` with `MAX_PLAYERS` |
| 280 | + |
| 281 | +Replace `GetVehiclePoolSize()` with `MAX_VEHICLES` |
| 282 | + |
| 283 | +Replace `GetActorPoolSize()` with `MAX_ACTORS` |
| 284 | + |
| 285 | +<hr /> |
| 286 | + |
| 287 | +- **warning 234: function is deprecated (symbol "SHA256_PassHash") Use BCrypt for hashing passwords** |
| 288 | + |
| 289 | +Use the [samp-bcrypt](https://github.com/Sreyas-Sreelal/samp-bcrypt) plugin for hashing passwords. SHA-256 is not secure. |
| 290 | + |
| 291 | +<hr /> |
| 292 | + |
| 293 | +- **warning 214: possibly a "const" array argument was intended: "?"** |
| 294 | +- **warning 239: literal array/string passed to a non-const parameter** |
| 295 | + |
| 296 | +For example: |
| 297 | + |
| 298 | +```pawn |
| 299 | +public MyFunction(string[]) |
| 300 | +// -> |
| 301 | +public MyFunction(const string[]) |
| 302 | +``` |
| 303 | + |
| 304 | +<hr /> |
| 305 | + |
| 306 | +- **error 025: function heading differs from prototype** |
| 307 | + |
| 308 | +For example: |
| 309 | + |
| 310 | +```pawn |
| 311 | +public OnPlayerDeath(playerid, killerid, reason) |
| 312 | +// -> |
| 313 | +public OnPlayerDeath(playerid, killerid, WEAPON:reason) |
| 314 | +``` |
| 315 | + |
| 316 | +```pawn |
| 317 | +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) |
| 318 | +// -> |
| 319 | +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) |
| 320 | +``` |
| 321 | + |
| 322 | +<hr /> |
| 323 | + |
| 324 | +:::note |
| 325 | + |
| 326 | +There is also an upgrade tool that attempts to find old untagged and const-incorrect code and upgrade it. |
| 327 | + |
| 328 | +https://github.com/openmultiplayer/upgrade |
| 329 | + |
| 330 | +Already included in `/qawno/upgrader` folder. |
| 331 | + |
| 332 | +::: |
| 333 | + |
| 334 | +## Runtime errors and warnings |
| 335 | +```log |
| 336 | +[Info] Couldn't announce legacy network to open.mp list. |
| 337 | +[Info] [Server Error] Status: 406 |
| 338 | +[Info] [Server Error] Message: {"error":"failed to query server: socket read timed out"} |
| 339 | +[Info] This won't affect the server's behaviour. |
| 340 | +``` |
| 341 | + |
| 342 | +- Your server is not accessible from the open.mp website. |
| 343 | +- You are probably running the server locally. |
| 344 | +- The firewall has blocked the connection. |
| 345 | + |
| 346 | +**This warning will not affect the behavior of the server.** |
| 347 | + |
| 348 | +<hr /> |
| 349 | + |
| 350 | +```log |
| 351 | +[Warning] Insufficient specifiers given to `format`: "?" < 1 |
| 352 | +``` |
| 353 | + |
| 354 | +The specifiers are less than the arguments you pass in the format. For example: |
| 355 | + |
| 356 | +```pawn |
| 357 | +new string[32]; |
| 358 | +new mp[32] = ".MP"; |
| 359 | +
|
| 360 | +format(string, sizeof(string), "OPEN", mp); |
| 361 | +// [Warning] Insufficient specifiers given to `format`: "OPEN" < 1 |
| 362 | +
|
| 363 | +// Should be: |
| 364 | +format(string, sizeof(string), "OPEN%s", mp); |
| 365 | +// ^^ |
| 366 | +``` |
| 367 | + |
| 368 | +## Useful documents |
| 369 | +Check out the new scripting functions and callbacks: https://www.open.mp/docs/server/omp-functions |
| 370 | + |
| 371 | +If you are completely new to Pawn programming: [readme-beginner](https://github.com/openmultiplayer/omp-stdlib/blob/master/documentation/readme-beginner.md) |
| 372 | + |
| 373 | +If you are an intermediate at Pawn programming: [readme-intermediate](https://github.com/openmultiplayer/omp-stdlib/blob/master/documentation/readme-intermediate.md) |
| 374 | + |
| 375 | +If you are an expert at Pawn programming: [readme-expert](https://github.com/openmultiplayer/omp-stdlib/blob/master/documentation/readme-expert.md) |
| 376 | + |
| 377 | +Blog post: [Porting to open.mp](https://www.open.mp/blog/porting) |
| 378 | + |
| 379 | +## Help |
| 380 | +If you still have issues running the server, please join the official open.mp Discord server: https://discord.gg/samp |
| 381 | + |
| 382 | +Ask in [#openmp-support](https://discord.com/channels/231799104731217931/966398440051445790) channel. |
0 commit comments