Skip to content

samp.json To pawn.json

Southclaws edited this page Jun 6, 2018 · 4 revisions

1.8 introduced a better way to configure live servers.

This short document will help you transition from the old way: using samp.json, to the new way: using the runtime field in pawn.json.

Step 1: Copy samp.json contents to runtime in pawn.json

The runtime field always exited in pawn.json - all you need to do is simply copy the contents of samp.json and paste it as the value of a new key named runtime in the pawn.json file.

For example, say your samp.json looks like this:

{
  "version": "0.3.7",
  "gamemodes": ["cnr"],
  "rcon_password": "turtles",
  "announce": true,
  "maxplayers": 32,
  "port": 8080,
  "filterscripts": ["admin-system"],
  "plugins": [
    "samp-incognito/samp-streamer-plugin",
    "Southclaws/pawn-requests",
    "my_custom_private_plugin"
  ]
}

And your pawn.json looks like this:

{
  "user": "Steve123",
  "repo": "SteveCNR",
  "entry": "gamemodes/cnr.pwn",
  "output": "gamemodes/cnr.amx",
  "dependencies": [
    "sampctl/samp-stdlib",
    "samp-incognito/samp-streamer-plugin",
    "Southclaws/pawn-requests"
  ]
}

You first want to add a new field named runtime to the end of the file, don't forget the comma after the last field:

{
  "user": "Steve123",
  "repo": "SteveCNR",
  "entry": "gamemodes/cnr.pwn",
  "output": "gamemodes/cnr.amx",
  "dependencies": [
    "sampctl/samp-stdlib",
    "samp-incognito/samp-streamer-plugin",
    "Southclaws/pawn-requests"
  ],
  "runtime":
}

Then simply paste the entire contents of samp.json immediately after "runtime":, and indent it, so it looks like:

{
  "user": "Steve123",
  "repo": "SteveCNR",
  "entry": "gamemodes/cnr.pwn",
  "output": "gamemodes/cnr.amx",
  "dependencies": [
    "sampctl/samp-stdlib",
    "samp-incognito/samp-streamer-plugin:2.9.3",
    "Southclaws/pawn-requests:0.6.1"
  ],
  "runtime": {
    "version": "0.3.7",
    "gamemodes": ["cnr"],
    "rcon_password": "turtles",
    "announce": true,
    "maxplayers": 32,
    "port": 8080,
    "filterscripts": ["admin-system"],
    "plugins": [
      "samp-incognito/samp-streamer-plugin:2.9.3",
      "Southclaws/pawn-requests:0.6.1",
      "my_custom_private_plugin"
    ]
  }
}

(If you're using vscode, it can automatically format your JSON file for you!)

Step 2: Remove redundant fields

One thing that sampctl will do with packages is automatically handle the gamemodes field and plugins for you.

Because samp-incognito/samp-streamer-plugin:2.9.3 and Southclaws/pawn-requests:0.6.1 are already in the dependencies field of pawn.json, they do not need to be present in the plugins field of runtime because sampctl already knows that these dependencies are plugins and will automatically generate a server.cfg with the plugin names in.

The same goes for gamemodes - because the pawn.json file already has the entry and output fields it already knows what .amx file is the gamemode, so you can safely remove the gamemodes field from the runtime section because it will be automatically filled with cnr based on the contents of the output field.

The finished example file now looks like this:

{
  "user": "Steve123",
  "repo": "SteveCNR",
  "entry": "gamemodes/cnr.pwn",
  "output": "gamemodes/cnr.amx",
  "dependencies": [
    "sampctl/samp-stdlib",
    "samp-incognito/samp-streamer-plugin:2.9.3",
    "Southclaws/pawn-requests:0.6.1"
  ],
  "runtime": {
    "version": "0.3.7",
    "rcon_password": "turtles",
    "announce": true,
    "maxplayers": 32,
    "port": 8080,
    "filterscripts": ["admin-system"],
    "plugins": ["my_custom_private_plugin"]
  }
}

Note the my_custom_private_plugin has remained in plugins because it's not a remote dependency, it's just a file in the plugins folder. This is still valid in case you need to use outdated plugins that do not provide Pawn Packages on GitHub.

Step 3: Add "local": true

We need to tell sampctl that this package is to be executed locally instead of in a temporary runtime area, to do this, simply set the field local to true in pawn.json:

{
  "user": "Steve123",
  "repo": "SteveCNR",
  "entry": "gamemodes/cnr.pwn",
  "output": "gamemodes/cnr.amx",
  "local": true,
  "dependencies": [
    "sampctl/samp-stdlib",
    "samp-incognito/samp-streamer-plugin:2.9.3",
    "Southclaws/pawn-requests:0.6.1"
  ],
  "runtime": {
    "version": "0.3.7",
    "rcon_password": "turtles",
    "announce": true,
    "maxplayers": 32,
    "port": 8080,
    "filterscripts": ["admin-system"],
    "plugins": ["my_custom_private_plugin"]
  }
}

Step 4: Delete samp.json

You may now safely delete the samp.json file as it's not necessary any more.