Global/CreateClientConVar

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
(Min/max args)
 
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=CreateClientConVar
 
|Parent=Global
 
 
|Description=Makes a clientside-only console variable
 
|Description=Makes a clientside-only console variable
  
Line 41: Line 39:
 
|desc=Help text to display in the console.
 
|desc=Help text to display in the console.
 
|default=""
 
|default=""
 +
}}
 +
{{Arg
 +
|type=number
 +
|name=min
 +
|desc=If set, the convar cannot be changed to a number lower than this value.
 +
 +
{{NextUpdate}}
 +
|default=nil
 +
}}
 +
{{Arg
 +
|type=number
 +
|name=max
 +
|desc=If set, the convar cannot be changed to a number higher than this value.
 +
 +
{{NextUpdate}}
 +
|default=nil
 
}}
 
}}
 
{{Ret
 
{{Ret

Latest revision as of 19:26, 11 October 2019

 CreateClientConVar( )

Contents

Description

Makes a clientside-only console variable

NOTE

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

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 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.

Arguments

string helptext=""

Help text to display in the console.

Arguments

number min=nil

If set, the convar cannot be changed to a number lower than this value.


Next Update Change

This feature is only available in the next update.

Arguments

number max=nil

If set, the convar cannot be changed to a number higher than this value.


Next Update Change

This feature is only available in the next update.

Returns

ConVar

Created convar.

Examples

Example

Creates a ConVar that does nothing and saves.

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


Personal tools
Navigation