跳到主要內容

Formatting examples

Everything you can use on a docs page, each shown as it looks and with the Markdown that makes it. Copy what you need. For the writing conventions (front matter, headings, links), see Contributing.

Admonitions​

Boxes for things readers must not miss. Keep them short and use them sparingly, or they stop standing out.

備註

A side remark: useful, but fine to skip.

資訊

Background that helps make sense of the page.

技巧

A better way to do something, or a shortcut.

注意

Something that can break a script or surprise the reader.

危險

Something that can crash the server or lose data.

:::note

A side remark: useful, but fine to skip.

:::

Swap note for info, tip, warning or danger. Leave a blank line after the opening ::: and before the closing one, or the content may not render as Markdown.

With a title​

Coming from SA-MP?

Put the title in square brackets straight after the kind.

:::tip[Coming from SA-MP?]

Put the title in square brackets straight after the kind.

:::

With lists and code​

注意
  • Skin 74 doesn't exist.
  • Skins 300 to 311 don't work on older clients.
SetPlayerSkin(playerid, 0);
:::warning

- Skin **74** doesn't exist.
- Skins **300 to 311** don't work on older clients.

```pawn
SetPlayerSkin(playerid, 0);
```

:::

Version banners​

Pages for functions and callbacks that only exist from a certain version start with a banner. Use the version it was added in.

注意

此函式於 omp v1.1.0.2612 版本中新增,在更早的版本中無法使用!

<VersionWarn version='omp v1.1.0.2612' />

For a callback, say so, and the banner reads "callback" instead of "function":

注意

此回呼函式於 SA-MP 0.3.7 版本中新增,在更早的版本中無法使用!

<VersionWarn name='callback' version='SA-MP 0.3.7' />

NPC callbacks get their own note:

備註

NPC 也可以呼叫這個回呼函式。

<NoteNPCCallbacks />

Code​

Code blocks​

Mark Pawn code as pawn:

public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

new string[64];
format(string, sizeof(string), "Welcome, {FFFF00}%s{FFFFFF}!", name);
SendClientMessage(playerid, -1, string);
return 1;
}
```pawn
public OnPlayerConnect(playerid)
{
...
}
```

Other languages work the same way: json for config files, bash for terminal commands, cpp for C/C++ plugin code.

"pawn": {
"main_scripts": ["gungame 1"]
}
./omp-server --dump-config

With a title​

gamemodes/mygamemode.pwn
#include <open.mp>

main() {}
```pawn title="gamemodes/mygamemode.pwn"
#include <open.mp>
```

Highlighting lines​

Point out the lines that matter, by number in the opening line or with a comment in the code:

public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
return 1;
}
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 50);
return 1;
}
```pawn {3}
...
```

```pawn
// highlight-next-line
GivePlayerWeapon(playerid, WEAPON_DEAGLE, 50);
```

Use // highlight-start and // highlight-end around several lines.

Inline code​

Put function names, values and file names in backticks: SetPlayerPos, Float:, config.json.

Put function names, values and file names in backticks: `SetPlayerPos`, `Float:`, `config.json`.

Tables​

HealthEngine status
650Undamaged
650-550White smoke
550-390Grey smoke
| Health | Engine status |
| ------- | ------------- |
| 650 | Undamaged |
| 650-550 | White smoke |
| 550-390 | Grey smoke |

Text​

Bold for words that must stand out, italics for emphasis, and links to other pages. Keys look like Ctrl + K.

**Bold** for words that must stand out, _italics_ for emphasis, and [links](Contributing) to other pages. Keys look like <kbd>Ctrl</kbd> + <kbd>K</kbd>.
  • Lists with a dash
  • One item per line
  1. Numbered steps
  2. In the order to follow them
- Lists with a dash
- One item per line

1. Numbered steps
2. In the order to follow them

A quote, for text taken from somewhere else.

> A quote, for text taken from somewhere else.

Collapsible sections​

For long content most readers can skip, such as a full example script:

Show the full script
#include <open.mp>

main()
{
print("Hello, world!");
}
<details>
<summary>Show the full script</summary>

```pawn
...
```

</details>

Images​

The body parts reference image

![The body parts reference image](https://assets.open.mp/assets/images/bodyParts/Body_parts.jpg)

Put your own images in a folder under frontend/public/images/ and link them as /images/your-folder/picture.png. Always describe the image in the square brackets.