G.CreateClientConVar

From GMod Wiki

Jump to: navigation, search
Function
Syntax CreateClientConVar( String convarName, String or Number default, Boolean shouldSave, Boolean userdata )
Where is this used?
Description:
Creates a clientside console variable. Default is the default value.
Returns: Convar
Part of Library: Global Functions
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.CreateClientConVar]G.CreateClientConVar [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis example adds a client console variable called "prp_bankamount".
Used onNewerClient.png
Code
CreateClientConVar("prp_bankamount", "0", false, false)
OutputN/A



DescriptionThis example adds a client console variable and stores the ConVar object for easy access to the var later in the script.
Used onNewerClient.png
Code
local mycconvar = CreateClientConVar( "my_client_var", "0", false, false )
 
//then to retrieve the set value later use one of these
local mystring = mycconvar:GetString()
local myint = mycconvar:GetInt()
local myfloat = mycconvar:GetFloat()
local mybool = mycconvar:GetBool()
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox