How to Compile a .sma File into .amxx

April 22, 2026 Daemon666 8 min read 16 преглеждания

AMX Mod X does not run .sma source directly. The compiler amxxpc turns Pawn source into .amxx bytecode, and only the .amxx goes on the server. This guide covers compiling locally with the compiler that ships inside AMX Mod X, reading its output, and the version pitfalls that cause bad load.

1. Find the compiler

Every AMX Mod X install ships amxxpc in the scripting folder:

addons/amxmodx/scripting/amxxpc         # Linux
addons/amxmodx/scripting/amxxpc.exe     # Windows

Alongside it is compile.sh (Linux) / compile.exe (Windows) and an include/ directory holding every .inc. Compile from inside this folder so the includes resolve.

2. Compile on Linux

amxxpc is a 32-bit binary, so a 64-bit host needs the 32-bit C runtime or the compiler will not even start:

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y lib32stdc++6 libc6:i386

Then compile:

cd addons/amxmodx/scripting
./amxxpc myplugin.sma

On success the last line is Done. and the output lands in compiled/myplugin.amxx. To build every .sma in the folder at once, use the batch script:

./compile.sh

3. Compile on Windows

cd addons\amxmodx\scripting
amxxpc.exe myplugin.sma

Or drag the .sma onto compile.exe. Output goes to the compiled\ subfolder. If nothing appears and a console window flashes, run it from cmd.exe so you can read the error.

4. Read the output

Distinguish the two message classes:

  • Warnings — the plugin still compiles. A .amxx is produced. Common ones: unused symbol, tag mismatch, symbol never used. Fix them, but they are not fatal.
  • Errors — no .amxx is produced. The build stops.

Typical errors and what they mean:

error 017: undefined symbol "cs_get_user_armor"

— a missing #include (here #include <cstrike>), or a typo in a native name.

error 001: expected token: ";" , but found ...

— a syntax error, usually a missing brace or bracket on the line above the one reported.

error 088: number of arguments does not match definition

— you called a native with the wrong argument count; check the declaration in the include file.

5. Target the right AMXX version

The .amxx must be compiled by a compiler no newer than the AMXX the server runs, or the server rejects it as bad load. If your server runs AMX Mod X 1.9, compile with the 1.9 amxxpc. Natives added in 1.9 (such as client_print_color) do not exist in the 1.8.2 compiler — if you use them, you must compile with 1.9 or newer. The safe rule: compile with the same AMXX version your server runs. See installing AMX Mod X 1.9.

6. Include third-party headers

If a plugin needs a header that is not in the stock include/ folder (for example reapi.inc for a ReAPI plugin), drop the .inc into addons/amxmodx/scripting/include/ before compiling. amxxpc searches that folder for #include <name>. Do not use a path in the include — put the file where the compiler already looks. When you use a native that only exists in a newer AMXX, the header must also be the newer one; a stale amxmodx.inc will report the native as an undefined symbol even though the compiler binary supports it.

6b. Compiling on your PC vs on the server

You do not have to compile on the game server. Many admins keep a copy of the scripting/ folder (compiler plus include/) on their workstation, compile there, and upload only the finished .amxx. That keeps source and build tools off the production box entirely. The one rule that never changes: the compiler version you build with must match the AMXX version running on the server, wherever you run it. If you maintain several servers on different AMXX versions, keep a separate scripting/ folder per version and compile against the right one.

7. Install the compiled plugin

cp compiled/myplugin.amxx ../plugins/myplugin.amxx

Add its filename to addons/amxmodx/configs/plugins.ini, then in the server console:

amxx reload

or change the map. Confirm it loaded with amxx list.

Common errors

  • amxxpc: No such file or directory on Linux — missing 32-bit runtime; install lib32stdc++6 and libc6:i386.
  • bad load on the server — compiled with a newer AMXX than the server runs. Recompile with the matching version.
  • undefined symbol — missing #include or a third-party .inc not in the include folder.
  • Compiles but does nothing — you copied the .sma to plugins/ instead of the .amxx. Only the compiled file loads.

Verification

A successful build produces compiled/myplugin.amxx and prints Done. with zero errors. After installing and reloading, amxx list shows the plugin as running. For an editor that runs amxxpc on a keystroke and jumps to the exact error line, set up VS Code for AMX Mod X.

Сътрудници: Daemon666 ✦
Сподели: