This guide is for people creating libraries intended to be consumed via sampctl.
- Includes-only library: ships Pawn
.inc(and maybe.pwn) sources only. - Plugin library: ships Pawn includes and server plugin binaries (
.so/.dll).
sampctl treats libraries the same way it treats gamemodes: as a package described by pawn.json / pawn.yaml.
Keep it boring and predictable:
- Put your public include at the repo root (recommended), e.g.
mylib.incso users can do#include <mylib>. - Keep a small entry script for compilation/tests, e.g.
test.pwn(ortests/test.pwn). - Optional: keep examples under
examples/.
Example:
.
├── pawn.json
├── mylib.inc
├── test.pwn
└── README.md
If you must keep sources in a subfolder (common for plugins that store C/C++ in the repo root), set include_path in pawn.json.
From your repo folder:
sampctl initFor a library, your entry should be a test / demo script, not the .inc itself.
Minimal pawn.json for an includes-only library:
{
"entry": "test.pwn",
"output": "test.amx",
"dependencies": ["pawn-lang/samp-stdlib"],
"runtime": {
"mode": "main"
}
}Notes:
dependenciesshould contain everything your library needs to compile when the user only includes your.inc.- Prefer
dev_dependenciesfor dependencies only used by your tests/demos (e.g.pawn-lang/YSI-Includesfory_testing).
Write libraries as if the user has zero other packages installed.
- Include what you use (yes, even
a_samp). - This makes your library compile in isolation and avoids “works on my machine” dependency drift.
sampctl buildsampctl build --watch
sampctl run --watchSet the runtime mode:
{
"runtime": {
"mode": "y_testing"
}
}Then:
sampctl run --forceEnsure --forceBuildA very effective pattern is making your entry a tiny gamemode that demonstrates the library in-game. Users can clone your repo and run:
sampctl ensure
sampctl runsampctl supports version pinning in dependencies (tags/branches/commits), so library authors should publish version tags.
Recommended:
- Use Semantic Versioning tags like
1.2.3(or your project’s established convention). - Create GitHub releases for tagged versions.
To create a versioned release interactively:
sampctl releaseIf your library depends on a server plugin, you have two goals:
- Make it easy for users to get the
.inc. - Make it easy for
sampctlto download the correct.dll/.sofor the user’s platform.
Plugin libraries should declare resources in pawn.json so sampctl can download the right binaries from GitHub release assets.
To avoid repeating (and keeping this guide focused on getting started), the detailed resources reference and examples live here:
Related user-facing docs:
- Setting
entryto your.inc(libraries should compile via a.pwnentry). - Forgetting to list a dependency your
.increlies on. - Shipping plugin binaries without GitHub releases / stable asset naming.
- Conflicting
.incfilenames across dependencies (avoid generic names and use include guards).