SwiftlyS2

IConVarService

Interface IConVarService

Namespace: SwiftlyS2.Shared.Convars

Assembly: SwiftlyS2.CS2.dll

public interface IConVarService

Methods

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
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 : unmanaged
Parameters
  • 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
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
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 : unmanaged
Parameters
  • 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
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
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
  • name string — The name of the convar.
  • value string — The value to replicate.

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
  • clientId int — The client id to replicate to.
  • name string — The name of the convar.
  • value string — The value to replicate.

On this page