API ReferenceConvars
IConVarService
Interface IConVarService
Namespace: SwiftlyS2.Shared.Convars
Assembly: SwiftlyS2.CS2.dll
public interface IConVarServiceMethods
Create<T>(string, string, T, ConvarFlags)
Create a new convar.
IConVar<T> Create<T>(string name, string helpMessage, T defaultValue, ConvarFlags flags = ConvarFlags.NONE)Parameters
- name string — The name of the convar.
- helpMessage string — The help message of the convar.
- defaultValue T — The default value of the convar.
- flags ConvarFlags — The flags of the convar.
Returns
- IConVar<T> — The created convar.
Type Parameters
- T — The type of the convar.
Create<T>(string, string, T, T?, T?, ConvarFlags)
Create a new convar with min and max values.
IConVar<T> Create<T>(string name, string helpMessage, T defaultValue, T? minValue, T? maxValue, ConvarFlags flags = ConvarFlags.NONE) where T : unmanagedParameters
- name string — The name of the convar.
- helpMessage string — The help message of the convar.
- defaultValue T — The default value of the convar.
- minValue T? — The min value of the convar.
- maxValue T? — The max value of the convar.
- flags ConvarFlags — The flags of the convar.
Returns
- IConVar<T> — The created convar.
Type Parameters
- T — The type of the convar.
CreateOrFind<T>(string, string, T, ConvarFlags)
Create a new convar or find an existing one by name.
IConVar<T> CreateOrFind<T>(string name, string helpMessage, T defaultValue, ConvarFlags flags = ConvarFlags.NONE)Parameters
- name string — The name of the convar.
- helpMessage string — The help message of the convar.
- defaultValue T — The default value of the convar.
- flags ConvarFlags — The flags of the convar.
Returns
- IConVar<T> — The created or found convar.
Type Parameters
- T — The type of the convar.
CreateOrFind<T>(string, string, T, T?, T?, ConvarFlags)
Create a new convar or find an existing one by name with min and max values.
IConVar<T> CreateOrFind<T>(string name, string helpMessage, T defaultValue, T? minValue, T? maxValue, ConvarFlags flags = ConvarFlags.NONE) where T : unmanagedParameters
- name string — The name of the convar.
- helpMessage string — The help message of the convar.
- defaultValue T — The default value of the convar.
- minValue T? — The min value of the convar.
- maxValue T? — The max value of the convar.
- flags ConvarFlags — The flags of the convar.
Returns
- IConVar<T> — The created or found convar.
Type Parameters
- T — The type of the convar.
Find<T>(string)
Find a existing convar by name.
IConVar<T>? Find<T>(string name)Parameters
- name string — The name of the convar.
Returns
- IConVar<T>? — The convar if found, null otherwise.
Type Parameters
- T — The type of the convar.
FindAsString(string)
Find a existing convar by name with no type.
IConVar? FindAsString(string name)Parameters
- name string — The name of the convar.
Returns
- IConVar? — The convar if found, null otherwise.
ReplicateToAll(string, string)
Replicate the value of the convar to all clients. You can use this method to replicate those convars that don't exist on server.
void ReplicateToAll(string name, string value)Parameters
ReplicateToClient(int, string, string)
Replicate the value of the convar to a specific client. You can use this method to replicate those convars that don't exist on server.
void ReplicateToClient(int clientId, string name, string value)Parameters