Modules

Docs / API / Modules / chat

Chat

Admin & chat

@s2script/sdk/chat

print messages to player chat.

1 export

Import

import { Chat } from "@s2script/sdk/chat";

Author-time types ship in the npm package; the engine injects the runtime at plugin load. Add @s2script/sdk to your plugin's dependencies.

API reference

Generated from the shipped type definitions.

const
Chat

Print messages to player chat (SayText2), with a caller-owned Chat.color prefix.

import { Chat } from "@s2script/sdk/chat";
Chat.toAll("[Vote] Result: " + winner);
Chat.toSlot(slot, "Usage:
color: string
An opaque prefix prepended to every chat message (NOT rcon/console replies). Color is content the caller owns (SourceMod-parity), so the engine-generic layer never picks one. A game/plugin sets this to a color control byte — e.g. Chat.color = ChatColors.Green from @s2script/cs2. "" = send raw (CS2 needs a leading control byte for chat to render). A message may also embed its own colors.
toSlot(slot: number, message: string): void
Print to the chat of the client in slot (0-based).
toAll(message: string): void
Print to every live player's chat.
Back to modules All packages

s2script — Source 2 plugin framework

GitHub