v0.2.2
For amxts 0.3.5 and later.
0.2.1 was published broken: npm install failed on it. 0.2.2 is the same code, published properly.
👉 Changelog
❤️ Contributors
- Ernest Manukyan (@kukson777)
For amxts 0.3.5 and later.
0.2.1 was published broken: npm install failed on it. 0.2.2 is the same code, published properly.
v0.3.6 is the next patch release.
@amxts/core@0.3.5 was published broken: npm install failed on it. It is deprecated now, and 0.3.6 replaces it.
The top of plugins/ holds the plugins and every subfolder holds code. Now amxts.config.ts can name more folders of plugins. A folder can also give its plugins a name prefix on the server:
export default defineConfig({
plugins: ["modules", { path: "games", prefix: "minigame_" }],
dir: { api: "api" },
});
plugins/
├── core.ts # plugin → core.aot
├── core/ # core.ts's code, not plugins
├── games/
│ └── hns.ts # plugin → minigame_hns.aot
├── modules/
│ └── duel.ts # plugin → duel.aot, runs api/duel.ts
└── api/
└── duel.ts # shared with every plugin: import * as duel from "~/api/duel"
dir.api keeps the modules your plugins share in a folder of your choice, modules/ by default. A module's plugin can sit in any folder of plugins, a prefixed one too, and the other plugins' calls find it there. Two files that come to one .aot name stop the build. A project without these keys builds as before.
player.kill() works in your tests: on the fake server the player stayed alive, since it did not run fakemeta's set_pev and the game's death (7d7b835).Update the CLI with your project's own package manager, then:
npx amxts upgrade
player.kill() on the fake server (7d7b835)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.For the 0.3 line of the core.
default group now exists from the start, so the answer is the default group's until the file is read (6d9fd57).For the 0.3.5 core and the later cores of the 0.3 line.
A grenade one partner threw bounced off the other. Now it flies through the partners of the player who threw it, on every server, with ReHLDS and ReGameDLL or without them.
A player who jumped on a partner's head fell through him. Now a player wholly above a partner stands on him, and each sees the other whole while he does. Two who are already in each other still pass, so nobody gets stuck.
Both are on, and the project turns them off in amxts.config.ts:
export default defineConfig({
modules: ["@amxts/semiclip"],
semiclip: {
grenades: false, // a grenade bounces off a partner of its thrower
standOnHead: false, // a partner above falls through
},
});
A plugin can turn standing on a head off for as long as it runs, so a server with several modes keeps head boosts in one and not in another:
semiclip.standOnHead = false; // while this plugin runs, a partner above falls through
When the plugin stops, the project's standOnHead comes back.
A partner fades out smoothly: he is whole at fadeDistance, as opaque as opacity at hideDistance, and closer than that he goes to nothing in a tenth of a second and comes back as you step away, instead of vanishing at once. He is blended as a whole, so a faint partner leaves no light outline. The module's look now hides him closer than 60 units instead of 48, and the project sets it in amxts.config.ts beside the rest, instead of a plugin setting the core's server.walkThroughLook:
export default defineConfig({
modules: ["@amxts/semiclip"],
semiclip: {
fadeDistance: 250, // closer than 250 units a partner is see-through
opacity: 0.4, // 40% opaque at hideDistance, whole at fadeDistance
hideDistance: 60, // closer than 60 units he fades out and is not drawn at all
},
});
player.walksThrough and server.walkThroughLook left the core's plugin API in 0.3.5. A plugin asks who walks through whom with semiclip.rule, and the look is the project's semiclip: { ... }.
semiclip.standOnHead set by a plugin while it runs (431107d)hideDistance (3c785e6)For the 0.3 line of the core.
SHOW_<MENU>. A menu nobody uses stays quiet until a plugin uses it (25a5534).v0.3.5 is a patch release of the 0.3 line, with one break: walking through each other is now the semiclip module's alone, so a plugin that set pairs or the look itself needs a change (below). Plugins built with 0.3.0 to 0.3.4 load on its module as they are; the new semiclip needs the 0.3.5 module, which
npx amxts upgradeputs on your server.
entries(), keys(), values()for...of over an array's entries() now compiles as plain TypeScript, and typed arrays have entries(), keys() and values() too:
for (const [i, name] of names.entries()) console.log(`${i}: ${name}`);
const bytes = new Uint8Array(4);
for (const i of bytes.keys()) bytes[i] = i;
The new sendUserInfo game event hears a player's userinfo on its way to each client. Writing a key of event.info changes only what that client sees of the player, such as the name in the scoreboard and the kill notices. The player, the game and the other clients keep the real one, so nobody is renamed and the chat says nothing. player.info.resend() sends a player's userinfo to every client now. Both work with ReHLDS and on plain HLDS, on Linux and Windows.
let shown: Player | null = null;
let shownName = "";
game.addEventListener("sendUserInfo", (event) => {
if (event.player == shown) event.info.set("name", shownName);
});
// "Killer + Assister" in the kill notice
shown = killer;
shownName = `${killer.name} + ${assister.name}`;
killer.info.resend();
The pairs and how partners pass and look are now the kit's, for a module that lets players walk through each other: walksThrough(player) is the players he walks through, as a Set, and setWalkThroughOptions sets the look up close, grenades passing a thrower's partners and standing on a partner's head - all off until a module turns them on. semiclip 0.2.2 is the module that offers them to a project.
import { setWalkThroughOptions, walksThrough } from "@amxts/core/kit";
walksThrough(player).add(teammate);
setWalkThroughOptions({ fadeDistance: 250, opacity: 0.4, hideDistance: 60, grenades: true, standOnHead: true });
server.advance(ms) runs the frames in between, so a server_frame listener is heard without a separate frame call. frameTime sets the frame's length (76bc6ed).UserMessage of a message the game registers with a fixed size, such as BuyClose, was not sent, and the console said the engine had not registered it. It is now the game's message, sent when exactly its size is written: new UserMessage("BuyClose").send(player) closes the player's buy menu (111f5c2).joinTeam stayed in the game's joining state: its next commands opened the team menu and put it at the intro cameras. It is now in the game (1fc50fe).message_begin the engine refused, such as a message of its own with an id the server never registered, crashed the server ("PF_WriteString_I: called with no active message"). The begin is now refused with an error in the plugin, and the writes after it go nowhere (8d999e5).player.walksThrough and server.walkThroughLook are gone from the plugin API: who walks through whom is the semiclip module's, so a server has one owner of it. I took them out in a patch rather than wait for 0.4, so this update can break a plugin that used them:
| 0.3.4 | 0.3.5 |
|---|---|
player.walksThrough.add(other) in a plugin | semiclip.rule = (player, target) => ... of @amxts/semiclip |
server.walkThroughLook = { fadeDistance, opacity, hideDistance } in a plugin | semiclip: { fadeDistance, opacity, hideDistance } in amxts.config.ts |
a module of your own with player.walksThrough | walksThrough(player) from @amxts/core/kit |
npx amxts upgrade does not rewrite these lines: the build names each one it cannot compile.
With ReGameDLL, a flash's light used to pass a partner. It now stops at him as at anyone, as it does in the game and on every other server.
npm install -D @amxts/cli@latest # pnpm add -D, yarn add -D, bun add -d
npx amxts upgrade
It moves @amxts/core to 0.3.5 and @amxts/semiclip to 0.2.2, and puts the 0.3.5 module on the server in AMXTS_SERVER.
for...of over an array's entries() (5abe3ce)setWalkThroughOptions for a module (a4fcb99)sendUserInfo event and player.info.resend (3d8d405)sendUserInfo on plain HLDS from the first map (06cd532)message_begin with an invalid id (8d999e5)sendUserInfo arrives in 0.3.5 (2922714)message_begin with an unregistered id is refused (0200614)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.For the 0.3 cores.
A SteamID can be faked on a server that lets players in without Steam, so I let any entry carry a password - a SteamID's and an IP's too, not only a name's. The player gives it with setinfo _pw; with a wrong one he plays as default. It is set and taken away from the server console, and the file keeps only its SHA-256:
perms user STEAM_0:1:12345 password secret
perms user STEAM_0:1:12345 password # no password any more
perms import keeps users.ini's passwords for SteamID and IP entries too.
The editor's page sees which entries have a password (password: true); the password itself never leaves the server.
perms import keeps the password of a SteamID or IP entry of users.ini that has no e flag, as AMX Mod X does: such a player gives it with setinfo _pw, or plays as default. Before, the import dropped it and let him in by his SteamID alone.For the 0.3.4 core and the later cores of the 0.3 line.
Installed, semiclip now reaches the server with no plugin of yours: it says standalone: true, and a 0.3.4 core builds it whenever amxts.config.ts lists it. Teammates walk through each other, and a partner is see-through up close, from npx amxts module add semiclip on. Before, the build left it out until some plugin used semiclip.
v0.3.4 is a patch release of the 0.3 line. Plugins built with 0.3.0 to 0.3.3 load on its module as they are.
A module no plugin uses is left out of the build, so that one installed and forgotten does not load on the server. That left out a module whose whole job needs no plugin: semiclip, whose rule covers every player. 👉 A module now says so in its definition, and is built whenever amxts.config.ts lists it:
export default defineModule({
meta: { name: "semiclip" },
standalone: true, // built whenever the config lists it
});
semiclip 0.2.1 says it: npx amxts module add semiclip, and teammates walk through each other with no plugin of your own.
npm install -D @amxts/cli@latest # pnpm add -D, yarn add -D, bun add -d
npx amxts upgrade
It moves @amxts/core to 0.3.4 and @amxts/semiclip to 0.2.1, and puts the 0.3.4 module on the server in AMXTS_SERVER.
amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.For the 0.3.3 core. It drives no older core, and a 0.3.2 command drives no 0.3.3 core: update both, the command first, then
npx amxts upgrade.
Every task of the core - build, dev, prepare, check, upgrade - runs on its own Node, and a project no longer installs Bun. The command takes a Bun from PATH only for bun test, in a project without Vitest, and says how to get one there. amxts info shows that Bun (475222b).
Before an upload, --against checks the built plugins against the module the server runs, read from its file. It names every plugin the module would refuse, with the imports the module lacks, and with --deploy nothing is deployed then:
npx amxts build --os linux --against amxts_amxx_i386.so
The module is the server's addons/amxmodx/modules/amxts_amxx_i386.so (or amxts_amxx.dll) (90afd41).
amxts module add perms finds @amxts/perms - groups and permissions with an editor in the browser - in the catalog the command carries (31eace9).
The official resemiclip module is semiclip now, @amxts/semiclip: npx amxts upgrade puts it in place of @amxts/resemiclip in package.json and amxts.config.ts, and amxts module add resemiclip adds it under its new name (043ba70).
--against checks plugins against a module (90afd41)For the 0.3.3 core and the later cores of the 0.3 line.
@amxts/resemiclip is @amxts/semiclip now, and it needs nothing but amxts. I moved semiclip off the ReSemiclip Metamod plugin: the rule you set drives the core's own pairs, player.walksThrough, which the core has since 0.3.3, so a server needs no plugin beside amxts. And it works as soon as it is installed: teammates walk through each other, see-through up close and not drawn right against you, before any plugin sets a rule. A rule reads as before:
semiclip.rule = (player, target) => player.team == target.team;
One thing was wrong in the old README: a pair walks through when the rule lets either one, not both - which is what ReSemiclip did too, so your rule behaves as it did. How a partner looks up close is the core's server.walkThroughLook:
server.walkThroughLook = { fadeDistance: 250, opacity: 0.4, hideDistance: 48 };
@amxts/semiclip: npx amxts upgrade puts it in place of @amxts/resemiclip in package.json and amxts.config.ts, and rewrites a plugin's import ... from "@amxts/resemiclip". The global semiclip keeps its name, so most plugins do not change.semiclip.passesThrough(player) is gone: write [...player.walksThrough].@amxts/core 0.3.3.server.walkThroughLook = { fadeDistance: 250, opacity: 0.4, hideDistance: 48 }). When the rule's plugin stops, teammates walk through each other again; semiclip.rule = null makes everyone solid. Nothing hands the rules back to ReSemiclip any more.@amxts/semiclip (f64ac55)v0.3.3 is a patch release of the 0.3 line. Plugins built with 0.3.0, 0.3.1 and 0.3.2 load on its module as they are; the new events need the 0.3.3 module, which
npx amxts upgradeputs on your server.
Since 0.3, entityState changes what one player sees of an entity. 👉 0.3.3 opens the rest of what the server sends a player each frame: what his own client is told about him (clientData), where the server looks from to pick what he is sent (visibility), and the move command his client sent (cmdStart). Each is written for one player alone, and a server with no listener pays nothing for it.
game.addEventListener("clientData", (event) => {
if (event.player.flags.includes("onGround")) return;
event.maxSpeed = 200; // his client predicts him slower in the air
});
const replays = new Map<number, number[]>(); // where the replay each player watches is, by id
game.addEventListener("visibility", (event) => {
const point = replays.get(event.player.id);
if (point != null) event.addOrigin(point); // he is sent the walls and doors around it too
});
A plugin that shows a player a place his own eyes are far from - a replay, a rewind, a camera - can now send him that place, and freeze or slow what he sees there without touching anyone else.
A throw in a listener that your own code reached - a command run with server_exec, a forward emitted, a player kicked - from inside a try or an async function ended that listener without a word, and landed in your code instead: a catch got it, an await rejected with it, and the rest of the function never ran. 👉 In 0.3.3 a listener is a call of its own wherever it starts from, as a listener of dispatchEvent is in JavaScript: its error ends that listener alone, the console names it, and your code goes on.
And every error a plugin hits now goes to AMX Mod X's log too (addons/amxmodx/logs), not only to the server console: a host's panel often keeps no console, and the log is what you send us when something breaks.
Semiclip needed a module of its own beside AMX Mod X, ReSemiclip, and the official resemiclip module only passed it bit masks. 👉 In 0.3.3 the core does it itself: two players you pair walk through each other, their clients predict it without a jolt, and one who comes close can turn see-through or vanish from your view. It all runs in the module, with no call into your plugin per pair, and a server with no pair pays nothing.
game.addEventListener("spawn", ({ player }) => {
for (const mate of server.players) if (mate.team == player.team) player.walksThrough.add(mate);
}, true);
server.walkThroughLook = {
fadeDistance: 250, // closer than this a partner is see-through...
opacity: 0.4, // ...this opaque right next to you
hideDistance: 48, // and closer than this, not drawn at all
};
One you cannot see is no target either: the name under your crosshair, your shots and +use go through him. And on ReGameDLL a partner does not shield you from a flash. The official semiclip module, @amxts/semiclip (the former resemiclip), moves onto it in its 0.2.0 and needs nothing but amxts; npx amxts upgrade puts it in place of @amxts/resemiclip.
One view model can hold several looks of a weapon as body groups - a knife with several finishes. weapon.viewBody picks the one his hands show, and a spectator watching him through his eyes sees the same:
game.addEventListener("defaultDeploy", (event) => {
if (event.weapon.classname != "weapon_knife") return;
event.viewModel = "models/myplugin/v_knife.mdl";
event.weapon.viewBody = 2; // the third finish of the model
});
entityState has the model's animation: sequence, gaitSequence, frame, frameRate, animTime and ducking. A frameRate of 0 holds a model in one pose for one player while the others see it move.
A cmdStart listener reads and writes the command the game moves a player by: forward, side, up, msec, buttons, angles and impulse, with the names bot.move takes.
server.addEventListener("cmdStart", (event) => {
// A side speed the strafe keys did not give is taken away.
if (event.side != 0 && !event.buttons.includes("moveLeft") && !event.buttons.includes("moveRight")) event.side = 0;
});
The fake server runs it too: server.runCommand(player, command), and server.sendVisibility(player) for the visibility listeners.
A plugin can now send its own message - to a client-side mod of yours, say - by name, as the game sends its own:
const jump = new UserMessage("MyJump"); // registered when the plugin starts
jump.byte(1).coord(distance).text(player.name).send(player); // one player
jump.byte(2).sendAll(); // everyone
get_user_msgid, message_begin and register_message know it, in Pawn plugins too, and it keeps its id on every map.
The game's temporary effects - a spray on a wall, sparks, a beam - are the tempEntity message: type is the effect's TE_* number and source what made it, the spray can (whose owner is the player) or the player whose move made it. And any message can now go to some players only, with recipients:
server.addMessageListener("tempEntity", (event) => {
const maker = event.source?.owner ?? 0; // a spray can's player
if (hidden.has(maker)) event.recipients = server.players.filter(player => !hidesOthers.has(player.id));
});
A plugin that awaits is no longer compiled twice, the compiles run side by side as far as the machine's memory allows, and every task of the amxts command - build, dev, prepare, check, upgrade - runs on Node, in far less memory. A save in amxts dev rebuilds a large plugin several times faster than in 0.3.2. A project no longer installs Bun: Node 24 is all it needs. amxts build writes the same files byte for byte.
Uploading a plugin's .aot to a running server restarts that plugin and the plugins that use its module - not every plugin - and the files are read and prepared while the game runs, so the players do not feel it. A plugin can carry what it holds across that restart:
let run = server.kept<Uint8Array>("run") ?? new Uint8Array(0); // what the previous run kept
server.addEventListener("end", () => server.keep("run", run));
A line added to plugins.ini loads its plugin, and a line taken out unloads it, with no restart and no command - a server without rcon included. A shared module's plugin loads before the plugins that use it wherever its line is, so a module listed last no longer loses every call its users make as they start (b32d173). And a dictionary uploaded after its plugin is read again as soon as it lands, not at the next map (8ea5dde).
amxts_slow_ms (5 ms unless you set it) is named in the console and in AMX Mod X's log, with its plugin and its time - and so is a plugin's async work after an await, and an upload's restart of plugins, split into its parts. When several listeners of one event held the frame together, the line says so and names the slowest of them in that very call, with its own time: by the function's name (trackRuns (3 of 10), 3.1 ms), or for an arrow by where it starts (a function at plugins/replay.ts:987 (5 of 10)). The line comes at once, then while it goes on after 10 s, 20 s, 40 s and so on up to 10 minutes, so a plugin a little over the limit does not fill the log. It prints the server's own amxts_slow_ms.server.precached counts the models, sounds and files the map has precached, and the log warns as they near the engine's 512 - naming the last file and the plugin.JSON.parse reads its text straight into the type you asked for, with no tree in between, and so a database query's rows - which reach a plugin as JSON - and fetch's answers come several times faster, with far less for the garbage collector. A plugin that reads thousands of rows no longer holds the frame for them. A text that does not fit the type is read the old way, so its error says the same as before.
concat takes any number of arguments, as in TypeScript: a.concat(1, [2, 3], b), s.concat("x", "y");entity.lip, how far short of its full travel a door, a platform or a button stops;values() and no length is walked by for...of and [...] as a Set is - player.walksThrough among them;amxts build --against amxts_amxx_i386.so says whether a server's module loads the built plugins, and what it lacks, before an upload; a build names the imports a plugin uses that the last release has not, and the module says "needs a newer amxts than 0.3.2" for one built with an unreleased core.docker stop or systemd crashed on the way out and left a core file, and Storage's last second was lost: the module's threads now stop cleanly at exit, the stores are written, and ReHLDS's own stop signal handler - installed broken by hlds_linux - is set again correctly (d5d0cfc, 9ad9590).message_begin and message_end left the message open, and the next message - the game's own - could break the server. The message is now ended or dropped and the plugin named (b082b16).null. Now the default stays, and a record that still cannot be read names the storage, the key and the field (d7e359e).amxts dev did not see a change to amxts.config.ts, amxts prepare on Windows wrote no tooltips in another language, and a plugin's test of an HTTPS server with its own certificate failed (0035d85, 8dc1435, 207f581).0 whatever it found, when the comparison was of fractional numbers and the best value was kept in a variable of the loop. A silent wrong answer since 0.3.0 (259cbbb).try or an async function was swallowed and cut its caller short (3b233b4).amxts_plugins lists it as stopped and shows each running plugin's memory, and amxts_reload starts it again (d68278e).amx_ban STEAM_0:1:123 - reached the command in five words, since the engine splits at :; a command's words now keep it whole, ,, ' and brackets too (97ac57a).write_* after a message_begin that failed - an id the game does not know, a player who is not there - reached the engine with no message open, and the server stopped. Now the writes and the end are dropped, the begin's error is logged, and the server goes on (8d4b091).mp.dll amxts does not know, game.restartRound() and the win check could call the wrong function and crash the server; they now answer 0 and say so once in the console (d42365d).player.kill() killed nothing on Valve's game when the player was a bot a plugin had added: the game's kill command turned him down. It now kills any living player on every server, and is recorded as the same suicide (59e7249).entity.killed(world, 0) - a death no damage led to - crashed a server running Valve's game (261f1dd).Update the command with your project's package manager, then upgrade:
npm install -D @amxts/cli@latest # pnpm add -D, yarn add -D, bun add -d
npx amxts upgrade
It moves @amxts/core to 0.3.3, builds, and puts the 0.3.3 module on the server in AMXTS_SERVER. Another server takes the module from the release and the .aot files from your build. Rebuild every plugin: a plugin built with 0.3.2 runs on the new module, but only a rebuilt one gets the fixes of the compiler and of listeners' errors.
The command and the core move together this time: every task of the command runs on Node now, and amxts 0.3.3 drives only a 0.3.3 core, as the 0.3.2 command drives only its own - each says which one to update when they differ. Update the command first, as above, and upgrade brings the core to it. A project needs Node 24 and no longer installs Bun.
!NOTE A plugin that listens to
clientData,visibility, readscmdStart's fields, makes aUserMessage, or usesserver.keep,server.kept,server.precached,player.walksThrough,server.walkThroughLookorentityState'ssoliddoes not load on an older module. Put the 0.3.3 module on the server with the plugin.A project's own 0.3.2 command, run as
npx amxts upgradebefore the command was updated, installs the 0.3.3 core and then stops with "speaks cli-api 6": runnpx amxts upgradeonce more, and the 0.3.3 command it installed finishes the upgrade.
clientData event and weapon.viewBody (02e72d7)entityState animation fields (e8274b2)clientData view fields (8d745f9)cmdStart reads the move command (212b4bb)server.precached and a warning near the precache room (1cc0911)entity.lip, how far a door stops short (4b4cd68)tempEntity, and recipients on any message (7c268db)plugins.ini order and changes on a live server (b32d173)mp.dll (d42365d)viewBody keeps the client's animation in step (42e5d2e)viewBody deploy's draw only in hand (d55b196)viewBody for in-eye spectators (572c09f)viewBody 0 holds the weapon (a97d3a4)viewBody when an in-eye spectator spawns (3d4ecbb)message_begin cannot stop the server (8d4b091)amxts.config.ts read again on Node (0035d85)SA_RESTORER for the Linux build (d051a07)amxts_slow_ms covers async work and reloads (ff30a71)JSON.parse text straight into T (bd769dc)plugins.ini order and watch, dictionaries read again (c9d7b1f)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.For cores of the 0.3 line from 0.3.2.
A server that runs the editor's store of its own gets its own link. With PERMS_EDITOR_URL in .env,
perms editor prints the store's address, and the store sends the browser on to the editor page
with that store:
PERMS_EDITOR_URL=https://perms.myserver.com
[perms] Open the editor (an hour): https://perms.myserver.com/editor#k3x9q2mw7a
The first release of Perms, for cores of the 0.3 line from 0.3.2.
Perms is a permissions module for amxts servers: it replaces AMX Mod X's admin.amxx with
permission nodes, groups and a web editor, the way LuckPerms does for Minecraft servers.
Pawn plugins keep working unchanged, because the module gives every player AMX Mod X's flags
from his amxx.* nodes.
A permission is a node, kz.admin.kick. kz.admin.* gives everything under it, and
-kz.admin.wipe takes one away. Groups inherit from each other and have a weight; every player
is in default; and a player's own grants come before his groups. A grant or a group can last
30d and then go by itself, and on a shared database it can count on one server only.
perms.declare({
"myplugin.kick": { description: "Kick players" },
"myplugin.help": { description: "Use /help", everyone: true },
});
server.addCommand<KickArgs>("/kick <target>", ({ player, target }) => {
if (!perms.has(player, "myplugin.kick")) return player.print("You may not kick");
target.kick("Kicked");
});
perms.addGroup(player, "vip", { for: 30 * 86400 });
perms.addEventListener("change", ({ player }) => refreshTag(player));
perms editor in the server console prints a link. The page shows every plugin's permissions
with their descriptions, a column per group, and the groups and players. Saving sends the changes
back, and the server applies them within seconds, without a restart. Passwords and the database's
address never leave the server.
The permissions live in perms.yaml, which you can edit by hand. Or, with PERMS_DB in .env,
they live in MySQL, shared by several servers, and a change on one reaches the others within five
seconds.
perms import users.ini turns AMX Mod X's admins into entries, with their flags as amxx.*
permissions. access, cmd_access, amx_mode, amx_password_field, amx_default_access and
amx_reloadadmins keep working. Pawn plugins can check nodes themselves through perms.inc:
perms_has, the groups, and the perms_changed forward.
Permissions change from the server console and in the editor. In the game, a player with
perms.view can look them up.
For cores of the 0.3 line.
amxts upgrade puts amxts_amxx on the first line of the server's modules.ini, moving the line up or adding it: a C++ module listed above it keeps its forwards from TypeScript plugins (16f32cd).
amxts_amxx first in modules.ini (16f32cd)v0.3.2 is a patch release of the 0.3 line. Plugins built with 0.3.0 and 0.3.1 load on its module as they are; the new things need the 0.3.2 module, which
npx amxts upgradeputs on your server.
A forward a Pawn plugin raises has reached Forward.subscribe since 0.3. A forward an AMX Mod X module written in C++ raises (MF_ExecuteForward) reached only the Pawn plugins. 👉 In 0.3.2 it reaches TypeScript too, after the Pawn plugins' handlers, with every kind of argument: numbers, floats, strings, arrays and by-reference values.
const jumped = new Forward<Player, number>("mymodule_on_jump");
jumped.subscribe((player, height) => {
console.log(`${player.name} jumped ${height} units`);
});
A module hands its forwards to amxts when AMX Mod X loads it after amxts, so amxts_amxx goes on the first line of modules.ini. npx amxts upgrade puts it there, and the server console names any module listed above it.
A Pawn forward made with ET_STOP or ET_STOP2 that a Pawn public stopped no longer reaches TypeScript subscribers, as AMX Mod X itself would do for one more plugin.
Without ReGameDLL, most of the game rules' events were heard only after the game had acted, and their questions (fallDamage, canHaveItem, canRespawn, ...) were not heard at all. 👉 In 0.3.2 they are heard the way ReGameDLL hears them: before the game acts, with answers, written fields and preventDefault() taken.
game.addEventListener("fallDamage", (event) => event.result / 2, true); // half the fall damage
game.addEventListener("addMoney", (event) => {
if (event.player.isBot) event.amount = 0;
});
That is 21 events - the questions, playerSpawn, playerKilled, newRound, deathNotice, gameThink and the rest - plus addMoney and giveDefaultItems. On Linux it works with any build of the game. On Windows it works with the builds of Valve's game amxts knows: the one steam installs and its steam_legacy branch. With another mp.dll the console says so once and the events are heard as before. The table on the hooks page shows what each event gives on such a server.
An element of a Uint8Array (and of Int8Array, Uint16Array, Int16Array, Uint8ClampedArray) is a number, as in JavaScript. Arithmetic on it no longer wraps at 8 bits, so reading a file's words gives what JavaScript gives:
const word = bytes[i] | (bytes[i + 1] << 8); // a little-endian word
Loops over bytes keep their integer code, and are faster than the same loop in Pawn.
push and unshift take any number of valuesnames.push("a", "b", "c");
names.push(...others);
entity.touch() and the entity actions (restart(), think(), ...) cost less, and are faster than Pawn's ExecuteHamB on every machine the speed suite runs on;ExecuteHam(Ham_DeathSound, ...) and any other Ham function Counter-Strike has not got crashed the server; such a call now answers 0 and says so once in the console (959bcf0).bytes[i] << 8 was cut back to 8 bits, so decoding a word from a file's bytes gave garbage (21610b6).@amxts/core/zlib and the query builder had no types on the site, and its examples did not type-check (a907e84, 58883e0).One, listed by npx amxts upgrade:
| 0.3.1 | 0.3.2 | upgrade |
|---|---|---|
a use event's event.caller was the one who used the entity, event.activator what passed the use on | named as the game passes them: event.activator uses the entity, event.caller passes the use on | lists each caller and activator of a use event |
entity.use() calls do the same as before; only its parameters' names changed.
Update the command with your project's package manager, then upgrade:
npm install -D @amxts/cli@latest # pnpm add -D, yarn add -D, bun add -d
npx amxts upgrade
It moves @amxts/core to 0.3.2, lists the use events to check, puts amxts_amxx on the first line of modules.ini, builds, and puts the 0.3.2 module on the server in AMXTS_SERVER. Another server takes the module from the release and the .aot files from your build.
Forward.subscribe (b036bc6).types.d.ts files in the site's declarations (58883e0)checkMapConditions not hooked on plain HLDS (a684626)original_hook's import passes the editor's check (dffb78d)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.For cores of the 0.3 line.
amxts needs Node.js 24 or newer, and says so on an older one: on Node 22, npm 10 fails installing a new project's test runner on Linux.
The line about the server's module says that a newer amxts is out and that amxts upgrade puts it in - as information while the module is of the project's line, as a warning when it is of another line and will load no plugin (e5510d1).
amxts for the server, told not warned (e5510d1)For cores of the 0.3 line, from 0.3.1.
A menu made only of text lines - rules, a help screen, a top list - pages itself: 8 Next, 9 Back and the page tag, a page ending before the menu's 512 bytes. linesPerPage puts more lines on a page:
const rules = menus.create("LIST_RULES", { title: "Rules", linesPerPage: 11 });
rules.setListSource(({ player }) => lang.translate(player, "RULES").split("|").map(line => menus.textRow(line)));
The page tag [n | m] ends the title's first line, so a title of two lines keeps its second under it.
linesPerPage, and the page tag ends a title's first line (478a052)linesPerPage hints for Menu and MenuOptions, en and ru (fafe7a2)v0.3.1 is a patch release of the 0.3 line. Plugins built with 0.3.0 load on its module as they are; the new things need the 0.3.1 module, which
npx amxts upgradeputs on your server.
A plugin that kept its records in Storage had them on one server only, and a plugin that wanted MySQL had to call a web service of its own in between. 👉 In 0.3.1, MySQL is part of amxts.
The module speaks MySQL itself - no client library to install, TLS included, MariaDB too - and every query runs on its own thread, so the server never waits for the database. Tables are described in TypeScript, the way Drizzle does it, and the rows come back typed:
import { asc, double, eq, int, table, varchar } from "@amxts/core/database";
export const records = table("records", {
id: int().primaryKey().autoincrement(),
steamId: varchar(32).notNull(),
map: varchar(64).notNull(),
time: double().notNull(),
});
const db = new Database(env("MYPLUGIN_DB")); // mysql://user:password@host:3306/myplugin, or jdbc:mysql://... as a game panel shows it
await db.create(records);
const top = await db.select().from(records)
.where(eq(records.map, server.map))
.orderBy(asc(records.time))
.limit(10);
await db.insert(records).values({ steamId: player.steamId, map: server.map, time })
.onConflictDoUpdate({ target: [records.steamId, records.map], set: { time } });
A misspelt column is an error in the editor. Every value goes to the server as a parameter, never as text in the SQL. Transactions (db.transaction(async (tx) => ...)), raw SQL beside the builder (db.query<Row>(sql, [values])), and bytes - a recording, a file - in BLOB columns as Uint8Array. Another database plugs in as a provider of its own scheme, with Database.register.
Unpacking a downloaded map held the server's frame for as long as it took, and players saw it. fs.extract now unpacks on the module's worker thread, and so do writing and reading bytes, and the new compression:
import * as zlib from "@amxts/core/zlib";
for (const entry of await fs.extract(await response.arrayBuffer())) {
fs.writeFileSync(entry.path, entry.data);
}
await fs.writeFile(`${server.dataDir}/myplugin/${name}.rec.gz`, await zlib.gzip(recording));
@amxts/core/zlib is Node's: gzip, gunzip, deflate, inflate, the raw forms, and a ...Sync of each.
Air acceleration, friction, stop speed and the rest for one player - the server moves him with them and his game predicts them, on any server:
player.movement.airAccelerate = 100; // strafes gain speed easily, for him alone
player.movement.friction = 2;
player.movement.reset(); // the server's again
The way plugins add fields to a player, they add them to an Entity - shared between plugins, gone with the entity:
declare module "@amxts/core" {
interface Entity {
doorSpeed: number;
}
}
door.doorSpeed = door.speed;
A sound or a shot can go to some players only - a player who hid the others no longer hears their steps:
game.addEventListener("startSound", (event) => {
event.recipients = server.players.filter(listener => !hidden(event.entity, listener));
});
door.emitSound("myplugin/creak.wav", { to: player }); // one player hears it
A client shows four HUD channels. A line with a higher priority keeps its channel, and a line whose time is up gives it back:
const speed = new HudLine({ priority: 1 }); // redrawn every frame, always on screen
entity.touch(other) and entity.restart(), done by the module;player.resetMaxSpeed(), player.jumpSlowdown, server.intermission();fs.existsSync(path, { game: true }) looks in every folder the game reads from;move event and touchCount/frameTime are heard too;string | number | boolean | null values, number | null, T | T[], and a Uint8Array in JSON as base64.Each of the new calls is checked against its Pawn way in the speed suite, and is faster.
Storage.get lost the last character of a value of 1 KB or more - JSON came back without its closing brace (2599130).amxclient_cmd reaches TypeScript commands and the "command" event (4e9118f).Infinity | 0 and every number past 2^63 convert as JavaScript does (1add817).facade.ts, hooks.ts (501a354).amxx modules and meta list (2889b27).rows.map((name) => ({ name, time })) is a Row[] (df82419).setTimeout(fn, 0) from a listener no longer loops server.advance (f6db4d4).Two, each listed or rewritten by npx amxts upgrade:
| 0.3.0 | 0.3.1 | upgrade |
|---|---|---|
fs.extract(bytes) gives the entries | a Promise: await fs.extract(bytes); the synchronous form is fs.extractSync(bytes) | rewrites a call without await to fs.extractSync; lists a named import or a reference handed on |
startSound's event.recipients a number (0, 1) | the players who hear it: event.recipients = server.players.filter(...) | lists each use |
A binary column read into a string field comes as base64 now, not as the bytes decoded as text; read it into a Uint8Array, or CAST(col AS CHAR) in the SQL.
amxts needs Node.js 24 or newer now: Node 22's npm 10 fails installing a new project's test runner on Linux. The command says so when it runs on an older Node.
Update the command with your project's package manager, then upgrade:
npm install -D @amxts/cli@latest # pnpm add -D, yarn add -D, bun add -d
npx amxts upgrade
It moves @amxts/core and @amxts/menu-core to 0.3.1, rewrites fs.extract, lists what to check by hand, builds, and puts the 0.3.1 module on the server in AMXTS_SERVER. Another server takes the module from the release and the .aot files from your build.
existsSync in the game's other folders (874c4e7)server.intermission (13ffbe4)amxclient_cmd reaches addCommand (4e9118f)emitSound's volume and attenuation as f32 bits (d538c1e)resetMaxSpeed without a gamedata search (8145d3f)server.storage keys are the Map's iterator (f7b8c38)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.FTP for amxts 0.2 and 0.3.
This release only widens the core it works with to @amxts/core ^0.2.0 || ^0.3.0, so it can be upgraded together with your project. Nothing else changes.
ReSemiclip for amxts 0.2 and 0.3.
This release only widens the core it works with to @amxts/core ^0.2.2 || ^0.3.0, so it can be upgraded together with your project. Nothing else changes. Its prebuilt plugin is built for 0.3; a 0.2 project compiles it once.
Menu Core for amxts 0.3. It needs
@amxts/core0.3 and@amxts/config-core0.2, andnpx amxts upgrademoves a project to them.
A plugin that answers a menu file's actions and placeholders can now give them all in one call, and read several menus ahead of time:
menus.register("CP_MENU", "CP_MORE");
menus.addActions({
CP_SAVE: save,
CP_WHERE: ({ player, menu }) => player.print(`You are in ${menu.name}`),
});
menus.addPlaceholders({
saved: player => `${savedBy(player)}`,
});
An action or a placeholder is a function of the player, or of the menu's context when it needs more. These calls cross between plugins, which is why this release needs the 0.3 core.
ADMIN and ACCESS_ADMIN built inA menu.ini written for the Pawn menu_core often uses the ADMIN condition or the ACCESS_ADMIN restriction. Pawn's menu_core answered them itself, so here they warned "not registered" and greyed the item out even for an admin. Menu Core now answers both: ban, rcon, admin or menu access (d, l, u, y). A plugin that registers either name still has the last word.
menu_core keeps its words in an [Основное] section. It was read as no menu, silently. It now reads as [MAIN], and a section that isn't a menu is reported in the console (be951c2).chooseteam, starts it again from its first page. Before, it redrew the page they were on and seemed to do nothing. From one of the menu's own items it still stays where it was (c6afcaf).0.3.0 (9d471a8).ACCESS_ADMIN built in (5ef9c8a)menu_core's Основное is MAIN (be951c2)0.3.0 (9d471a8)player.print, not the free print (2622715)The command for amxts 0.3.
amxts devamxts dev builds, deploys to your server and does it again on every save. Now a panel stays under its lines while it runs: the server's map, players and FPS, each plugin's state and the last rebuild. Keys rebuild, change the map or restart the round without leaving the terminal. One dev runs per project.
Prefer plain lines? npx amxts dev --no-tui.
amxts rconRun a command on the project's server and see the answer, without opening a game client:
npx amxts rcon amxts_plugins
--json gives the answer to a script or an agent.
The command prints one line when a newer amxts is out, so you don't have to check yourself.
amxts upgrade in a 0.2 project installs this command and hands the rest over to it: the 0.3 core, the modules' versions for it, your code rewritten where 0.3 changed the API, a build, and the module on your server. It also takes 0.2's host plugin out of AMX Mod X. A build that fails now fails the upgrade, so you see it at once.
The project a new npx create-amxts writes greets players with player.print and the whole server with server.print.
amxts logo in the banner (e80a915)amxts rcon sends a command to the server (9a93721)amxts is out (f7e4d25)player.print, the wave is server.print (52467a0)amxts rcon and the update line (cfbefbc)Config Core for amxts 0.3. It needs
@amxts/core0.3, andnpx amxts upgrademoves a project to it.
Nothing changes for you in how configs are read. The plugin prints through the 0.3 core's player.print (cc0fc72), which 0.2 doesn't have, so this is a minor release with the new core as its minimum. It also reports its version, 0.2.0 (f85ddc8).
0.2.0 (f85ddc8)player.print, not the free print (cc0fc72)v0.3.0 is the next minor release.
In 0.2, amxts was two pieces: the amxts_amxx module, and a host plugin, amxts_host.amxx, that sat in AMX Mod X's plugins.ini and passed the game's events on to TypeScript. Every event took a detour through Pawn on its way to your plugin.
👉 In 0.3, the host plugin is gone.
The module is a Metamod plugin as well, and it hears the game itself: the players' commands, the messages, the cvars, the log, the menus, and ReGameDLL's and ReHLDS's hookchains through its own hooks. Nothing goes in plugins.ini any more, and there is no Pawn between the game and your code.
It made amxts faster, too. I check every release against Pawn twins of the same plugins, measure by measure, and a TypeScript plugin now runs at least as fast as Pawn on every measure the suite runs, and faster on most.
What ReAPI's rg_* natives did for the API, the module now does itself, through ReGameDLL's own API, and through the game's functions on Valve's HLDS. Giving and taking weapons, switching teams, respawning, models, the HUD, text menus, game.restartRound() and game.checkWinConditions() all work the same on:
ReAPI's natives are still there in @amxts/core/natives, for when your server has it and you want one.
A server never compiles anything now: it loads the .aot files a project builds. You build with npx amxts build and upload, or let amxts dev / build --deploy do it, the same way a .sma is compiled at home and an .amxx uploaded. The server kit is a fraction of its old size as a result, and a plugins.ini line that says name.ts simply loads name.aot.
A plugin built with 0.3.0 loads on every 0.3 module: 0.3.1, 0.3.2 and so on. The official modules ship prebuilt plugins that serve the whole line, so a patch release of the core never makes you (or a module's author) rebuild.
env()A token or an API key shouldn't be in your code, and it shouldn't be in the .aot either: anything compiled into a plugin can be read back out of it. env() reads it on the server instead:
const token = env("MYPLUGIN_TOKEN"); // required: text
const maxRecords = env("MYPLUGIN_MAX", 100); // a number
const debug = env("MYPLUGIN_DEBUG", false); // on/off: 1/0, true/false, yes/no, on/off
The values live in the server's addons/amxts/.env, and the server process's environment wins over the file, so a game panel or Docker can pass them without any file on the server at all. The default gives the type. A call without one is required: the plugin doesn't start until the value is there, and the console says which one it needs, in one line. amxts dev warns you before it deploys.
player.print and server.printPrinting to one player or to everyone reads the way it says:
player.print(`Welcome back, ${player.name}!`);
player.print("Round restarted", "center");
server.print("Map changes in 30 seconds");
Chat goes through the engine directly, so a chat message is as cheap as in Pawn.
One command can have several names, and its handler gets the player:
function checkpoint(player: Player) {
player.print("Checkpoint saved");
}
server.addCommand(["/cp", "cp"], checkpoint); // in chat and in the console
server.addCommand(["/kz", "chooseteam"], (player) => openMenu(player));
And every command a player types reaches the "command" event, with its name, words and text, where preventDefault() stops it:
server.addEventListener("command", (event) => {
if (event.command == "chooseteam" && !event.player.isAlive) event.preventDefault();
});
"entityState" is what the server sends one player about one entity, every frame. Change it, and only that player sees the change:
game.addEventListener("entityState", (event) => {
if (event.player.team != "CT") {
event.preventDefault(); // a marker only the CTs see
return;
}
event.renderFx = "glowShell"; // and it glows for them
event.renderColor = [0, 160, 255];
}, { classname: "myplugin_marker" });
server.plugins lists every plugin on the server, TypeScript and Pawn alike, and lets you stop, start and reload one, load one the list doesn't name, or call a Pawn plugin's public function:
const shop = server.plugins.find(plugin => plugin.file == "shop.aot");
shop?.reload();
new Storage<T>(name) keeps any interface, saved as JSON, and a missing key reads as undefined, the same as Map.get:
interface Profile { kills: number; title: string }
const profiles = new Storage<Profile>("myplugin_profiles");
profiles.set(player.steamId, { kills: 10, title: "Rookie" });
A new Storage takes over AMX Mod X's nVault file of the same name once, so nothing is lost when you move a Pawn plugin over.
Files can be read and written as bytes, and fs.extract unpacks a zip archive, so a plugin can download a map and put it in place:
import * as fs from "@amxts/core/fs";
const response = await fetch(`https://maps.example.com/${name}.zip`);
for (const entry of fs.extract(await response.arrayBuffer())) {
fs.writeFileSync(entry.path, entry.data);
}
The player's movement events (move, airMove, jumpMovement, duckMovement, ladderMove and the rest) have event.touchCount and event.frameTime. That's enough for jump stats without ReAPI's get_pmove.
trace.line, player.aim (what a player is aiming at), canSee;player.send and server.send;player.model, player.info, player.country, player.showMotd, and a light style for one player;player.screen.hint and HudLine.showAll;Record<string, T> and a rest parameter can cross, and Array#flatMap compiles;amxts typecheck points at an event name kept in a variable, and at const rows = [] without its element type.amxts dev has a panel: the server's map, players and FPS, each plugin's state and the last rebuild, with keys to rebuild, change the map or restart the round. amxts rcon sends a command to the server, and the command tells you when a newer amxts is out.
.aot uploaded while the server reads it is no longer loaded half-written (a16271d2).viewModel and weaponModel are the model's file, as text (25a13ffc).SVC_NEWMOVEVARS, SVC_LIGHTSTYLE, …), not only temporary effects (609d07b2).Each with what to write instead; upgrade says what npx amxts upgrade does for you.
| 0.2 | 0.3 | upgrade |
|---|---|---|
print(player, text), print(player.id, text) | player.print(text) | rewrites it, and drops print from the core's import once none is left |
print(0, text) | server.print(text) | rewrites it |
print({ id, variant }, text) | player.print(text, variant) | rewrites it; another field is listed |
print(5, text) (a number) | player.print(text) | lists it |
storage.get(key) gives null for a missing key | undefined, as Map.get; a Storage is data/amxts/storage/<name>.json, and a new one takes AMX Mod X's nVault file of its name once | rewrites == null and a string | null annotation of its value |
player.give(name as ItemName) | player.give(name): any text | drops the cast, and its import when nothing else names the type |
player.removeAllItems(true) | player.removeAllItems({ suit: true }) | rewrites it |
viewModel / weaponModel a number | the model's file, text ("models/v_knife.mdl") | 0 becomes ""; another number is listed |
a test's server.vault(name) | server.storage(name) | rewrites it |
cmd(name, handler, flag, info), cmdWide(...) | no info | drops it |
the server events "pause", "unpause", "modules" | gone: AMX Mod X raises them for a Pawn plugin about itself alone | lists the listener |
reapi's DisableHookChain(handle) of a hook() handle | unhook(handle) | lists it |
a raw native's const string as cells("h") | the string as it is: "h" | lists it |
a raw native that registers for its calling plugin - set_task, register_clcmd, register_event, register_message, RegisterHam, RegisterHookChain, menu_create, log_amx... | answers 0 from TypeScript: use the API's timers, commands, events and Menu | - |
.ts files on the server, built there | npx amxts build and upload the .aot, or build --deploy / amxts dev; a plugins.ini line name.ts loads name.aot | builds the project; the server step puts the module in |
amxts_host.amxx in AMX Mod X | nothing: amxts is the module alone | the server step takes the line, the plugin and its list out |
addons/amxts/tools/ and build/ of an older kit | not used | - delete them |
the changeYaw event's answer | a number of degrees, a float, as the game's function returns | - |
a command's description in amx_help / amxx cmds | listed by server.commands alone | - |
First update the command with your project's own package manager. A 0.2 project's amxts is the one its core came with:
npm install -D @amxts/cli@latest # pnpm add -D, yarn add -D, bun add -d
Then run:
npx amxts upgrade
It moves @amxts/core to 0.3.0 and each official module to its version for it (menu-core 0.3.0, config-core 0.2.0, resemiclip 0.1.3, ftp 0.1.1), rewrites your code (the table above), builds, and puts the 0.3.0 module on the server in AMXTS_SERVER. Stop a running Windows server first, or run npx amxts upgrade --server-only after.
Then read its "to check by hand" list and run npx amxts test. For any other server, upload the .aot files, and delete an old kit's addons/amxts/tools/ and addons/amxts/build/.
!NOTE Known issues:
Infinity | 0andInfinity >>> 0give-1and4294967295instead of0. A plugin named like a file of the core's API (facade.ts,constants.ts,hooks.ts, …) takes that file's place in the build, so name it otherwise. A Pawn plugin'samxclient_cmdreaches no TypeScript command.
bot.command (c1e439af)game.restartRound() and checkWinConditions() (7c34005f)0.3 API - plugins, storage, traces, messages (c4aa1d13)player.model, HUD from the module, entityState (9fa8eee9)flatMap (9aa7d20d)mp_freezetime and mp_round_infinite by default (dd4143c6).aot (b94dbe87)player.print, no free print (d7fcf7a7)preventDefault() stops a player's command (9ecf3eca)env() and the server's .env (db01c7d7)touchCount and frameTime of the movement (0b4d3865)viewModel and weaponModel are text (25a13ffc)player.fallVelocity sets the game's own too (b2c113f9)showMotd (44e48de4)amxts check in a project names typecheck and build (4cab6433).aot read while it is written (a16271d2)0.3's other breaks are listed (56e4ff90)player.name read once until it changes (9a28e9bf)read_argc (78b635b2)trace.line and plugin.call stand for (f4236f44)authKey through Reunion's API (c0d96c9f)ACCESS_ADMIN are built in (434c1803)amxts rcon and the update line (eea6c15f)bot.command (c1e439af)0.3 API - plugins, storage, traces, messages (c4aa1d13).aot (b94dbe87)player.print, no free print (d7fcf7a7)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module and an example plugin, hello.aot.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.wamrc-* - WAMR's AOT compiler, per system, which @amxts/wamrc-<system> carries for npx amxts build.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.A fix for a project that began on an amxts whose API lived in the plugins folder: its plugins/ still held that API's files (constants.ts, facade.ts and the rest), and the build took each for a plugin, so npx amxts upgrade ended with constants does not compile. The upgrade removes those copies and names them; the build leaves them out with a warning. An author's own file of such a name is kept.
npx amxts upgrade in the project, with the server stopped: it moves @amxts/core to 0.2.4, removes the old API copies from plugins/, builds the plugins again and puts the 0.2.4 module on the server named in .env. A server installed by hand takes the module (and amxts-compile, where it has one) from this release, and its plugins are built again.
plugins/ and says to delete them, and the modules stay prebuilt (22303d7, 7ec565c)npx amxts upgrade removes the old copies of amxts's API from plugins/, after rewriting the imports of them (634912c)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module, and the compiler for .ts plugins written on the server.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.amxts-compile-*, wamrc-* - the on-server compiler and WAMR's AOT compiler, per system.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.A project's tests run without Bun: a project or module made with npm, pnpm or Yarn tests on Node with Vitest, and amxts test runs the project's Vitest when it has one. With Bun nothing changes. It goes with @amxts/core 0.2.3, whose fake server loads under Node.
amxts test runs vitest run in a project with vitest installed, else bun test (1184a2e)A fix for a plugin that gives items on playerSpawn: when a bot took the slot of a player who had left the map, the game spawned it before it counted it in again, so the listener ran for a player ReAPI still counted out. Every ReAPI native it called then failed with player N is not connected, which the server log showed as run time errors of amxts_host.amxx. Such a spawn no longer reaches the listeners; the bot's next spawn does, as before.
A plugin's tests on the fake server run under Node with Vitest as well as under bun test: @amxts/core/test-utils loaded only under Bun.
npx amxts upgrade in the project, with the server stopped: it moves @amxts/core to 0.2.3, builds the plugins again and puts the 0.2.3 module on the server named in .env. A server installed by hand takes the module (and amxts-compile, where it has one) from this release, and its plugins are built again.
To run an existing project's tests on Node: npm i -D vitest, import test and expect from vitest instead of bun:test, and npx amxts test (@amxts/cli 0.2.1) runs Vitest.
playerSpawn for a player counted out - a bot that takes the slot of one who left the map no longer reaches the listeners while ReAPI's natives refuse it (0d7ce9f)@amxts/core/test-utils loads under Vitest as under bun test (4917b15)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module, and the compiler for .ts plugins written on the server.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.amxts-compile-*, wamrc-* - the on-server compiler and WAMR's AOT compiler, per system.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.Built for @amxts/core 0.2.2: the package's prebuilt plugin is compiled with that core, so a project on 0.2.2 takes it as it is instead of compiling the module on its first build. The module's API does not change.
npx amxts upgrade in the project takes it with the core.
| Package | Range |
|---|---|
@amxts/core | ^0.2.0, prebuilt for 0.2.2 |
Built for @amxts/core 0.2.2: the package's prebuilt plugin is compiled with that core, so a project on 0.2.2 takes it as it is instead of compiling the module on its first build. The module's API does not change.
npx amxts upgrade in the project takes it with the core.
| Package | Range |
|---|---|
@amxts/core | ^0.2.0, prebuilt for 0.2.2 |
Built for @amxts/core 0.2.2: the package's prebuilt plugin is compiled with that core, so a project on 0.2.2 takes it as it is instead of compiling the module on its first build. The module's API does not change.
npx amxts upgrade in the project takes it with the core.
| Package | Range |
|---|---|
@amxts/core | ^0.2.0, prebuilt for 0.2.2 |
A fix for a server that crashed at start on some AMX Mod X builds: the module registered its server commands with fewer arguments than AMX Mod X reads, and AMX Mod X read a command's description from leftover memory. Whether it crashed depended on the AMX Mod X build and the plugins loaded - most often with one or two plugins. The server suites run on AMX Mod X 1.9 and the newest 1.10 as well from now on.
npx amxts upgrade in the project, with the server stopped: it moves @amxts/core to 0.2.2, builds the plugins again and puts the 0.2.2 module on the server named in .env. A server installed by hand takes the module (and amxts-compile, where it has one) from this release, and its plugins are built again.
register_srvcmd, register_clcmd, set_task, RegisterHam - gets all its parameters (c02eb1e)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module, and the compiler for .ts plugins written on the server.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.amxts-compile-*, wamrc-* - the on-server compiler and WAMR's AOT compiler, per system.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.Fixes for 0.2.0: a plugin's call could fail at random when a native wrote into a buffer near the end of its memory, a build after an upgrade could keep plugins of the old version that the new module refuses, amxts upgrade rewrote the module's own files when the project lives in the server's folder, and the editor marked error.message in a catch as an error.
npx amxts upgrade in the project: it moves @amxts/core to 0.2.1, builds the plugins again and puts the 0.2.1 module on the server named in .env. A server installed by hand takes the module (and amxts-compile, where it has one) from this release; the plugins are built again, since the module loads only plugins of its own release.
msvcp140.dll predates Visual Studio 2022 17.10 (04dbe6b)get_players, which server.players calls, among them - no longer fails the plugin's call when the array lies near the end of the plugin's memory (e5dee94)catch (error) reads error.message without a cast, as the compiler and the docs do (d2875cf)addons/amxts/plugins/ - when the project lives in the server's folder (c400c24)configsQueued and configsExecuted when the map starts, as AMX Mod X does (2be9123)amxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module, and the compiler for .ts plugins written on the server.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.amxts-compile-*, wamrc-* - the on-server compiler and WAMR's AOT compiler, per system.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.0.2.0 makes a server one module to install and runs it on Valve's own HLDS as well as ReHLDS. Plugins get commands with typed arguments, menus, fetch, FTP and SFTP, bots, game messages by name, errors that point at their TypeScript, and names in the player's words. A 0.1.0 project moves over with amxts upgrade.
A server needs the addons/ folder of the server kit and one line in modules.ini:
amxts_amxx
Nothing goes into plugins.ini: the module brings its host plugin itself, writes it next to AMX Mod X's plugins when it starts, and removes it when it stops. An install from 0.1.0 can drop its amxts_host.amxx line; the console says so once.
amxts runs on Valve's own HLDS as well as on ReHLDS. The same plugin works on both, unchanged:
takeDamage, spawn, killed, jump and more;newRound, roundStart, roundEnd), spawns, purchases, money and the bomb, heard through the game's own log lines and messages - after the fact, so preventDefault() on them says once that it cannot stop them.What plain HLDS cannot give at all - ReGameDLL's own functions - prints one line in the console when a plugin listens for it, and a project with target: "hlds" does not build with such a listener. Each event's page says how it behaves on plain HLDS.
entity.origin, player.health, player.money and every other field are read and written where the game keeps them, on both servers, without a native call. A field the player sees on the HUD - money, the armor type, the flashlight's battery, night vision, the defuse kit - is sent to the player as the game sends it.
The usage is the command's help and its parser at once: <name> is required, [name] optional, and the interface you name says what each one is.
interface KickArgs {
target: Player;
reason?: string;
}
server.addCommand<KickArgs>("/kick <target> [reason]", ({ player, target, reason }) => {
target.kick(reason ?? `Kicked by ${player.name}`);
}, { access: "Kick", description: "Kick a player" });
Player is found by #userid, by the whole name or by a part of it;number is parsed, a union of words is one of them, the last text argument takes the rest of the line;player is always the one who typed the command. server.commands lists every command with its usage, description and access, for a /help of your own.
Menu is AMX Mod X's own menu - number keys, pages with Back and More, Exit - written as objects. Each item has a title, and may say when it is shown (visible) and when it can be chosen (enabled, drawn grey otherwise); both are asked again at every show, for the player it is shown to. Choosing an item runs its onSelect and closes the menu.
const shop = new Menu("Shop");
shop.addItem({
title: "Armor - $1000",
enabled: ({ player }) => player.money >= 1000,
onSelect: ({ player }) => {
player.armor = 100;
player.money -= 1000;
},
});
shop.addItem({
title: ({ player }) => `Heal (${player.health} HP)`,
visible: ({ player }) => player.isAlive,
onSelect: ({ player }) => {
player.health = 100;
},
});
server.addCommand("/shop", ({ player }) => shop.show(player));
A menu of the players on the server is a loop over server.players, one item for each. The official @amxts/menu-core takes the same shape in code - menus.create(...), addItem({ title, visible, enabled, onSelect }) with ({ player }) - and adds menus read from INI, YAML or JSON files, named conditions and actions, and lists with a row per player (({ player, target })).
fetch and useFetch, as in the browserHTTPS, redirects, timeouts and retries, on a thread of their own, so the game never waits. useFetch never throws: it gives back data (the JSON, read as the type you name), error and status.
interface Weather {
temperature: number;
}
server.addCommand("/weather", async ({ player }) => {
const { data } = await useFetch<Weather>("https://api.example.com/weather", {
query: { city: "Riga" },
timeout: 5000,
retry: 2,
});
if (data) print(player, `${data.temperature}°`);
else print(player, "The weather service is not answering");
});
fetch is the browser's own beneath it, for a raw Response, headers and streams.
@amxts/ftpA new official module: FTP, FTPS and SFTP, since game hosts give access to a server by those. Every call is a promise on the same network thread as fetch; files go between the game folder and the other server whole, binary included (maps, demos), without passing through the plugin.
import { ftp } from "@amxts/ftp";
const client = await ftp.connect("sftp://backup@example.com", { password: settings.password });
await client.upload("addons/amxmodx/logs/today.log", "logs/today.log");
await client.download("/maps/de_dust2.bsp", "maps/de_dust2.bsp");
const entries = await client.list("/configs");
await client.close();
SFTP takes a password or an RSA key, and can check the host's key. Keep the password in a config, not in the code.
A fake client is a player like any other: it is in server.players, it joins a team, it can be kicked. It has no AI of its own; move drives it, one frame at a time.
const bot = server.addBot("Spectator"); // Player | null when the server is full
bot?.joinTeam("SPECTATOR");
const runner = server.addBot("Runner");
server.addEventListener("frame", () => runner?.move({ forward: 250, buttons: ["jump"], angles: [0, 90, 0] }));
The natives with a ... tail - engfunc, dllfunc, pev, ExecuteHam and the rest - take text, floats and vectors as well as numbers, and what a native writes back is read through Ref:
const id = engfunc(EngFunc_CreateFakeClient, "Dummy");
const reason = new Ref("");
dllfunc(DLLFunc_ClientConnect, id, "Dummy", "127.0.0.1", reason);
A message the game sends a player is heard by its name, in the player's words, with typed fields:
server.addMessageListener("death", (event) => {
if (event.headshot) print(0, `${event.killer?.name} - headshot - ${event.victim?.name}`);
});
server.addMessageListener("progressBar", (event) => {
console.log(`a bar for ${event.seconds} s, from ${event.startPercent}%`);
});
Every message has a description, with the game's own name (DeathMsg, BarTime) beside it, so a Pawn author finds it. Where the game sends one thing in several messages, one name hears them all: progressBar (from zero or from a percent), spectatedHealth (the health of the player a spectator watches), hint (the hint box, with or without texts put into it). player.screen.progressBar(5, { startPercent: 40 }) shows one.
When a call fails - a null read with !, an error nobody catches, a stack overflow - the console prints the TypeScript stack, file, line and column, with the source line itself:
[amxts] shop.aot: TypeError: Unexpected 'null'
at price (plugins/shop/shop.ts:26:9)
26 | return item!.price;
at onSelect (plugins/shop/shop.ts:30:15)
console.error(error) and error.stack give the same stack. The map from the plugin's code to its TypeScript travels inside each .aot; the source line appears where the .ts is next to the plugin, as in amxts dev.
The API speaks the way players and plugin authors do, not the way the game's source does:
| 0.1.0 | 0.2.0 |
|---|---|
Player.all() | server.players |
player.account | player.money |
restartRound, onRoundFreezeEnd | newRound, roundStart |
flPlayerFallDamage, fPlayerCanTakeDamage | fallDamage, canTakeDamage |
fireBullets3 | shoot |
game.c4Guy, game.numCtWins | game.bomber, game.ctWins |
server.addEventListener("message:DeathMsg", ...) | server.addMessageListener("death", ...) |
buttons: ["Jump"], access "Kick" | buttons: ["jump"], access "kick" |
Game messages have named, typed fields too: event.killer, event.victim, event.headshot on DeathMsg. Fields that mean nothing to a plugin - the AI members of a player, Condition Zero's career - are left to @amxts/core/natives.
amxts upgrade rewrites a 0.1.0 project: imports, command handlers, Player.all and every renamed field and event. What it cannot be sure of, it lists.
Player.all(filter) is server.players; filter it with .filter(...).player.account is player.money; restartRound, onRoundFreezeEnd and addAccount are newRound, roundStart and addMoney; fireBullets3 is shoot; about a hundred more follow the same rule (the full list is in amxts upgrade's output). Internal fields left the API and are reached through @amxts/core/natives.({ player }) => ..., not (player, args) => ....@amxts/core/http is gone: fetch and useFetch are globals. easy_http is no longer needed on the server.@amxts/core/natives, /fs, ...); ~/ is the project's own files only.server.addMessageListener(name, ...), by their new names; the message: prefix of addEventListener is gone."jump", "muzzleFlash", "kick".@amxts/menu-core's code API takes one options object and one context: addItem({ title, onSelect: ({ player }) => ... }).amxts-compile must come from the same release: the module refuses a compiler of another build.steamId, not authid; server events are named as authors say them: putInServer, configsExecuted, pluginsLoaded, changeLevel.From 0.1.0, update the command first, with the package manager the project uses: npm install @amxts/cli@latest, bun add @amxts/cli@latest, pnpm add @amxts/cli@latest or yarn add @amxts/cli@latest. Then run npx amxts upgrade in the project: it updates the packages, rewrites the code, builds, and updates the server named in .env.
preventDefault() on them says once that it cannot stop them. ReGameDLL's own functions are not heard at all..ts is next to it; in a full build, small functions are inlined and a frame may show its caller's name.amxts_amxxtarget: "hlds" stops a build that listens for what plain HLDS cannot hearserver.commands for a /helpMenu over AMX Mod X's menusfetch and useFetch as globals, over libcurl and mbedTLS inside the modulerequest over HTTP, FTP, FTPS and SFTP, for modules@amxts/ftp among the official modulesserver.players replaces Player.all@amxts/core/nativesserver.addBot and bot.move; a fake client joins the spectators on both servers... tail takes text, floats, vectors and players; Ref reads what it writes backserver.addMessageListener by the player's names, with a description for eachAMXTS_SERVER may name the server's root or its cstrike folderamxts_load, amxts_unload and amxts_reload <plugin> for one plugin; amxts_plugins shows each one's stateplayer.authType, protocol and authKey from ReuniononPluginStop), and drops what it gaveMenu@amxts/core/natives, /constants, /fs, /os, /kit, /checkamxts upgrade rewrites imports, command handlers, Player.all and every renamed field and eventghcr.io/amxts/serverboolean | function fields, has ? get : fallback, a caught error read off a return, new Map(entries) and new Set(values), narrowing on assignmentDate.UTC with fewer argumentsawait, and a reload of all loads each plugin onceamxts-server-windows-x64.zip, amxts-server-linux-x64.tar.gz - the server kit: the module, and the compiler for .ts plugins written on the server.amxts_amxx.dll, amxts_amxx_i386.so - the module alone.amxts-compile-*, wamrc-* - the on-server compiler and WAMR's AOT compiler, per system.amxts-windows.json, amxts-linux.json - what each was built from, with every file's sha256.The first release: FTP, FTPS and SFTP for amxts plugins. Upload, download and list files on another server; every call is a promise on amxts's network thread, so the game never waits, and files go between the game folder and the other server whole, binary included.
import { ftp } from "@amxts/ftp";
const client = await ftp.connect("sftp://backup@example.com", { password: settings.password });
await client.upload("addons/amxmodx/logs/today.log", "logs/today.log");
await client.close();
SFTP takes a password or an RSA key in PEM, and can check the host's key.
menu-core for amxts 0.2.0: every menu function takes the menu's context, items take one options object as the core's Menu does, and a menu stays open while its plugin reloads.
A title, visible, enabled and onSelect take one object, { player, target, row, menu }:
const shop = menus.create("SHOP", { title: ({ player }) => `Shop - $${player.money}` });
shop.addItem({
title: ({ player }) => `Heal (${player.health} HP)`,
visible: ({ player }) => player.health < 100,
onSelect: ({ player }) => {
player.health = 100;
},
});
In a list of players, target is the player of the row.
When the plugin that made a menu reloads - a save under amxts dev, amxts_reload - a player looking at the menu keeps it, on the same page, drawn from the new code. When the plugin is unloaded, its menus, items, placeholders and conditions go with it.
({ player }) => ..., not (player) => ....addItem takes one options object: addItem({ title, onSelect }), not addItem("Title", { onSelect }).(player, viewer, name) arguments.npx amxts upgrade rewrites both: the functions to the context and addItem to its options. Files of menus (INI, YAML, JSON) do not change.
| Package | From | To |
|---|---|---|
@amxts/core | ^0.1.0 | ^0.2.0 |
@amxts/config-core | ^0.1.0 | ^0.1.1 |
server.players over Player.all (0a8c748)lowerCamelCase name (13b2645)putInServer by its new name (ac6243e)player.money (0e0f3ca)resemiclip for amxts 0.2.0. Its API is unchanged; the rule a plugin sets goes when that plugin stops, so ReSemiclip gets its own rules back.
None in resemiclip itself; it needs @amxts/core 0.2.
npx amxts upgrade in the project updates it with the core.
| Package | From | To |
|---|---|---|
@amxts/core | ^0.1.0 | ^0.2.0 |
server.players over Player.all (ab12133)putInServer and playerChange by their new names (9b407b7)config-core for amxts 0.2.0. Its API is unchanged: a plugin that reads its configs needs nothing new.
None in config-core itself; it needs @amxts/core 0.2.
npx amxts upgrade in the project updates it with the core.
| Package | From | To |
|---|---|---|
@amxts/core | ^0.1.0 | ^0.2.0 |
lowerCamelCase name (74c8ddf)The command for amxts 0.2.0. amxts upgrade moves a 0.1.0 project over in one step, and a new project starts from 0.2.0's API.
amxts upgradeOne command updates the packages, rewrites the code for the renamed API, builds, and puts the release's module, compiler and wamrc on the server named in .env, with a backup of each file it replaces. --dry-run shows what it would do; --no-server and --server-only do half of it.
hello.ts has a typed config and a menu that greets the player by name; with @amxts/menu-core, its starter menu takes the menu's context.
AMXTS_SERVER may name the server's root or its cstrike folder.
@amxts/core 0.2.x only. A 0.1.0 project runs amxts upgrade first.Update the command with the package manager the project uses - npm install @amxts/cli@latest, bun add @amxts/cli@latest, pnpm add @amxts/cli@latest or yarn add @amxts/cli@latest - then run npx amxts upgrade.
amxts upgrade downloads the release from GitHub; without network access run it with --no-server and install the server kit by hand.| Package | From | To |
|---|---|---|
@amxts/core | ^0.1.0 | ^0.2.0 |
hello.ts (50a7343)knip 6 in a new project (868f2e3).bin on yarn (1262f55)putInServer (e20acbe)The first release. Install from the .vsix below: VS Code → Extensions → ··· → Install from VSIX. On Open VSX (Cursor, VSCodium, Windsurf): search for amxts.