const
ServerServer console + globals: run commands, register/read/set cvars, and query map/time state.
import { Server } from "@s2script/sdk/server";
// plugins/basecommands/src/plugin.ts:46 — sm_map
Server.command("changelevel " + map);command(cmd: string): voidcmd at the server console (queued; executes next frame).isMapValid(map: string): booleanmap is an installed, valid map file.getCvar(name: string): string"" if the cvar doesn't exist (or an unsupported type → "<type>").setCvar(name: string, value: string): void<name> <value>), which the console splits on ; — treat value like command() input and
sanitize/quote any untrusted value to avoid command injection. Queued: applies next frame.registerCvar(name: string, opts: {
type: "bool" | "int" | "float" | "string";
default: boolean | number | string;
help?: string;
flags?: number;
min?: number;
max?: number;
}): booleanflags
are additive raw FCVAR bits. Read the value with getCvar; set it with setCvar/the console.
min/max apply to numeric types only.readonly maxPlayers: numberGetMaxClients()). 0 if unavailable.readonly mapName: stringGetMapName(), the BSP). "" if unavailable.readonly gameTime: numberGetGlobals()->curtime). 0 if unavailable.