|
VoltMod
C++23 framework for CS2 server plugins
|
RAII server console command: registers a tier1 ConCommand on construction and unregisters on destruction. More...
#include <ServerCommand.hpp>
Classes | |
| struct | Impl |
Public Types | |
| using | Handler = std::function< void(const CCommand &args, int slot)> |
Public Member Functions | |
| ServerCommand (std::string_view name, std::string_view helpText, Handler handler, bool playersCanRun=false) | |
| ~ServerCommand () | |
| ServerCommand (const ServerCommand &)=delete | |
| ServerCommand & | operator= (const ServerCommand &)=delete |
RAII server console command: registers a tier1 ConCommand on construction and unregisters on destruction.
Use this for server-console, RCON, cfg, and loosely coupled automation surfaces. Invoke commands through ConVars::ExecuteServerCommand. Prefer ServiceExchange when two plugins need a typed, versioned contract.
The handler runs on the game thread. Construct only while the plugin is loaded (ICvar must be live); typically a manager member, so destruction on unload unregisters it.
Definition at line 22 of file ServerCommand.hpp.
slot is the player who typed it in their own console, or -1 for the server.
Definition at line 26 of file ServerCommand.hpp.
| VoltMod::ServerCommand::ServerCommand | ( | std::string_view | name, |
| std::string_view | helpText, | ||
| Handler | handler, | ||
| bool | playersCanRun = false |
||
| ) |
Runs for the server console, RCON and cfg files; with playersCanRun, also from a player's own console. Otherwise the engine refuses a player before the handler runs.
Definition at line 35 of file ServerCommand.cpp.
|
default |
|
delete |
|
delete |