|
VoltMod
C++23 framework for CS2 server plugins
|
One service covers every message destination. See Messages and chat colors for colors, translation keys and broadcasts.
CS2 drops center HTML almost immediately after a death, a team switch or a HUD update, so a sticky panel has to be re-sent. VoltMod::CenterHtml owns that loop and nothing else; the deadline or expiry policy is yours.
A per-slot prompt registry. It powers menu text input and can be used directly.
| Method | What it does |
|---|---|
BeginCapture(slot, prompt, callback, timeoutMs = 60000) | Wait for the slot's next chat line, replacing any pending prompt. A positive timeout cancels the capture. |
IsCapturing(slot) | Whether a prompt is pending. |
CancelCapture(slot) | Drop the prompt without firing the callback. |
GetPrompt(slot) | A copy of the active prompt as std::optional<std::string>. |
The service subscribes to VoltMod::SlotEvents itself, so a pending prompt is cancelled when the slot changes hands.
The framework consumes active prompts before it dispatches commands, and raises runtime.Players.Said only for a line neither took. A plugin with its own chat rules subscribes to that and sets Blocked to keep the line out of chat:
VoltMod::Vote draws the engine's yes/no panel with user messages and counts the ballots itself, from the vote command the panel's F1/F2 keys send. The panel is the engine's, so the title must be a #SFUI_vote... or #Panorama_vote... token the client already has; arbitrary text does not render. Only one vote runs at a time, open to every connected human; bots get no ballot.
Start returns false when a vote is already running or no human is connected. A player who leaves without voting stops counting as eligible. VoteEndReason is AllVoted, TimeUp or Cancelled. Every callback runs on the game thread.