Creates a new console variable.
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | A valid ConVar object on success, None otherwise. See ConVar Objects |
Finds the specified ConVar. Returns None if the ConVar could not be found.
| Parameter: | name (str) – The name of the ConVar to retrieve |
|---|---|
| Return type: | sourcemod.console.ConVar |
| Returns: | A valid ConVar object on success, None otherwise. |
Registers a new console command or hooks an existing one.
| Parameters: |
|
|---|
callback is the function to call when the console command is executed. This callback should have one parameter: a ConCommandReply object.
Executes a command is if it were run on the server console.
| Parameter: | command (str) – Command to execute |
|---|
These constants describe how the Source engine should handle console commands and variables. Most of the descriptions below come directly from the Source SDK.
| Name | Description |
| FCVAR_NONE | The default; no flags at all |
| FCVAR_UNREGISTERED | If this is set, don’t add to linked list, etc. |
| FCVAR_LAUNCHER | Defined by launcher. |
| FCVAR_GAMEDLL | Defined by the game DLL. |
| FCVAR_CLIENTDLL | Defined by the client DLL. |
| FCVAR_MATERIAL_SYSTEM | Defined by the material system. |
| FCVAR_PROTECTED | A server cvar that contains sensitive data, such as a password. When its value is requested, it sends 1 if it’s not empty/zero, and 0 otherwise. |
| FCVAR_SPONLY | This cvar cannot be changed by clients connected to a multiplayer server. |
| FCVAR_ARCHIVE | Set to cause this cvar to be saved to vars.rc |
| FCVAR_NOTIFY | Notifies players when the cvar’s value is changed. For example, this flag is set for sv_cheats |
| FCVAR_USERINFO | Changes the client’s info string. |
| FCVAR_PRINTABLEONLY | This cvar’s string cannot contain unprintable characters (e.g., used for player name, etc.) |
| FCVAR_UNLOGGED | If the cvar has FCVAR_SERVER set, don’t log changes to the log file / console if we are creating a log |
| FCVAR_NEVER_AS_STRING | Never try to print that cvar. |
| FCVAR_REPLICATED | Server setting enforced on clients. |
| FCVAR_CHEAT | Only useable in singleplayer / debug / multiplayer & sv_cheats 1 |
| FCVAR_STUDIORENDER | Defined by the studiorender system. |
| FCVAR_DEMO | Record this cvar when starting a demo file. |
| FCVAR_DONTRECORD | Don’t record this command in demo files. |
| FCVAR_PLUGIN | Defined by a 3rd party plugin. |
| FCVAR_DATACACHE | Defined by the datacache system. |
| FCVAR_TOOLSYSTEM | Defined by an IToolSystem library. |
| FCVAR_FILESYSTEM | Defined by the file system. |
| FCVAR_NOT_CONNECTED | Cvar cannot be changed by a client that is connected to a server. |
| FCVAR_SOUNDSYSTEM | Defined by the soundsystem library. |
| FCVAR_ARCHIVE_XBOX | Cvar written to config.cfg on the Xbox. |
| FCVAR_INPUTSYSTEM | Defined by the inputsystem DLL. |
| FCVAR_NETWORKSYSTEM | Defined by the network system. |
| FCVAR_VPHYSICS | Defined by vphysics. |
Creates a hook that is called when this console variable’s value is changed.
| Parameter: | callback (callable) – The function to call when the ConVar is changed. |
|---|
The callback should have the prototype callback(cvar, oldvalue, newvalue), where cvar is the ConVar object representing the ConVar that was changed, oldvalue is the previous value of the ConVar as a string, and newvalue is the value being assigned to the ConVar as a string.
Removes a ConVar change hook from the update list. callback will no longer be called when the ConVar is changed.
| Parameter: | callback (callable) – The active hook to remove |
|---|---|
| Raises ViperException: | |
| No active hook on the ConVar, or an invalid or unregistered callback supplied. | |
Replies to the client whom executed the ConCommand in the way they executed the ConCommand (either in the console or in chat).
| Parameter: | message (str) – The message to send |
|---|