VS Code Setup for AMX Mod X (Syntax, Snippets, Build Task)

June 3, 2026 Daemon666 8 min read 11 vistas

Editing .sma files in Notepad is a needless handicap. VS Code gives you Pawn syntax highlighting, symbol navigation across the AMXX includes, and — the real win — a build task that runs amxxpc with a single shortcut and puts the compiler's errors directly in the Problems panel, clickable to the exact line. This is a one-time setup.

1. Install a Pawn / AMXX extension

Open the Extensions view (Ctrl+Shift+X) and search for AMXX Pawn or Pawn. Install an extension that provides Pawn language support — syntax highlighting, bracket matching, and ideally snippets for AMXX natives. There are community extensions dedicated to AMX Mod X Pawn; pick one with recent updates and a reasonable install count. If none suits you, a generic Pawn grammar still gives correct highlighting because AMXX Pawn shares the base syntax.

2. Point the editor at the AMXX includes

Symbol lookup and go-to-definition only work if the editor can see the .inc files. Open your plugin folder as a workspace and add the scripting include path to the workspace settings. Create .vscode/settings.json:

{
  "files.associations": {
    "*.sma": "pawn",
    "*.inc": "pawn"
  }
}

Then either work directly inside addons/amxmodx/scripting/ (so include/ is present), or copy the include/ folder next to your sources. Extensions that support an include-path setting will expose one — set it to the folder containing amxmodx.inc.

3. Create a build task that runs amxxpc

This is the part that makes VS Code worth it. Create .vscode/tasks.json. On Linux:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Compile AMXX",
      "type": "shell",
      "command": "./amxxpc",
      "args": [ "${file}" ],
      "options": {
        "cwd": "/home/steam/hlds/cstrike/addons/amxmodx/scripting"
      },
      "group": { "kind": "build", "isDefault": true },
      "problemMatcher": {
        "owner": "pawn",
        "fileLocation": [ "absolute" ],
        "pattern": {
          "regexp": "^(.*)\\((\\d+)\\) : (warning|error) \\d+: (.*)$",
          "file": 1, "line": 2, "severity": 3, "message": 4
        }
      }
    }
  ]
}

On Windows, change command to amxxpc.exe and cwd to your Windows scripting path (for example C:\\hlds\\cstrike\\addons\\amxmodx\\scripting).

4. What the problemMatcher does

amxxpc prints errors in the form myplugin.sma(42) : error 017: undefined symbol "foo". The regex above parses that line into a filename, line number, severity, and message, so VS Code populates the Problems panel and underlines line 42. Clicking the entry jumps straight there. That turns the compile-fix-recompile loop from copy-pasting line numbers into pressing one key.

5. Bind the build key

With the task set as "isDefault": true, press Ctrl+Shift+B to compile the open .sma. The compiler output appears in the integrated terminal and errors appear in Problems. No shell juggling, no leaving the editor.

6. Snippets (optional but worth it)

Add your own snippets for the boilerplate you type constantly. File → Preferences → Configure Snippets → pawn, then add:

{
  "plugin_init": {
    "prefix": "plugininit",
    "body": [
      "public plugin_init() {",
      "\tregister_plugin(\"$1\", \"1.0.0\", \"$2\")",
      "\t$0",
      "}"
    ]
  }
}

Type plugininit and press Tab to expand the whole stub.

7. Editing on a remote server

If your sources live on a Linux game server rather than your PC, use the VS Code Remote - SSH extension to edit them in place. You open the remote scripting/ folder as a workspace, and the exact same tasks.json runs amxxpc on the server itself — no uploading, no version-mismatch risk, because you are compiling with the server's own compiler against the server's own include/. The Problems panel still works over the SSH connection. This is the cleanest setup when you administer several remote servers: one editor, and each server compiles with its own toolchain.

8. Auto-install on successful build

You can chain the build task to copy the compiled plugin into plugins/ so it is ready to amxx reload. Add a second task that depends on the compile and copies compiled/${fileBasenameNoExtension}.amxx into the plugins folder, then make that the default build task. Keep the copy step separate from the compile so a failed build never overwrites a working plugin — only a clean Done. should reach the live plugins/ directory.

Common errors

  • Build task does nothing / "command not found" — wrong cwd, or amxxpc is not executable. On Linux run chmod +x amxxpc and confirm the 32-bit runtime is installed (see compiling a .sma).
  • Errors compile but do not appear in Problems — the problemMatcher regex does not match your compiler's output format; compile once in a terminal and adjust the regex to the exact line shape.
  • No syntax highlighting — the file is not associated with pawn; check files.associations.
  • Go-to-definition fails on natives — the include path is not set, so the editor cannot see amxmodx.inc.

Verification

Open a known-good .sma, press Ctrl+Shift+B, and confirm the terminal prints Done. and a compiled/*.amxx appears. Then introduce a deliberate error — delete a semicolon — rebuild, and check the Problems panel lists it and clicking jumps to the line. When both work, your edit-compile loop is complete; pair it with your first plugin and iterate.

Colaboradores: Daemon666 ✦
Compartir: