Global/CreateClientConVar

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Fixed CreateClientConVar example from sending in wrong data type)
(It's actually recommended to keep numbers as strings ( Since they are converted to strings in engine anyway ))
Line 14: Line 14:
 
}}
 
}}
 
{{Arg
 
{{Arg
|type=number
+
|type=string
 
|name=default
 
|name=default
 
|desc=Default value of the ConVar.
 
|desc=Default value of the ConVar.
Line 36: Line 36:
 
{{Example
 
{{Example
 
|Description=Creates a ConVar that does nothing and saves.
 
|Description=Creates a ConVar that does nothing and saves.
|Code=CreateClientConVar("superspeed_enabled", 0, true, false)
+
|Code=CreateClientConVar("superspeed_enabled", "0", true, false)
 
}}
 
}}

Revision as of 23:38, 10 June 2015

 CreateClientConVar( )

Contents

Description

Makes a clientside-only console variable

Arguments

string name

Name of the ConVar to be created and able to be accessed.

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

Arguments

string default

Default value of the ConVar.

Arguments

boolean shouldsave=true

Should the ConVar be saved across sessions

Arguments

boolean userdata=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.

Returns

ConVar

Created convar.

Examples

Example

Creates a ConVar that does nothing and saves.

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


Personal tools
Navigation