Garry's Mod Wiki

CreateClientConVar

ConVar CreateClientConVar( string name, string default, boolean shouldsave = true, boolean userinfo = false, string helptext, number min = nil, number max = nil )

Description

Makes a clientside-only console variable

This function is a wrapper of CreateConVar, with the difference being that FCVAR_ARCHIVE and FCVAR_USERINFO are added automatically when shouldsave and userinfo are true, respectively.

Although this function is shared, it should only be used clientside.

Arguments

1 string name
Name of the ConVar to be created and able to be accessed.<br><br>

This cannot be a name of existing console command or console variable. It will silently fail if it is.

2 string default
Default value of the ConVar.
3 boolean shouldsave = true
Should the ConVar be saved across sessions
4 boolean userinfo = false
Should the ConVar and its containing data be sent to the server when it has changed. This make the convar accessible from server using Player:GetInfoNum and similar functions.
5 string helptext
Help text to display in the console.
6 number min = nil
If set, the convar cannot be changed to a number lower than this value.
7 number max = nil
If set, the convar cannot be changed to a number higher than this value.

Returns

1 ConVar
Created convar.

Example

Creates a ConVar that does nothing and saves.

CreateClientConVar("superspeed_enabled", "0", true, false)

Page Links


Special Pages


Wikis

?

Render Time: 54ms

Session 0
DB GetPage 3
Generate Html 25
SaveChanges 12
Render Body 0
Render Sidebar 11