Garry's Mod Wiki

Revision Difference

Global.CreateConVar#527439

<function name="CreateConVar" parent="Global" type="libraryfunc"> <description>Creates a console variable (<page>ConVar</page>), in general these are for things like gamemode/server settings. <bug issue="3323">FCVAR_ARCHIVE causes default value replication issues on clientside FCVAR_REPLICATED convars and should be omitted clientside as a workaround</bug>⤶ </description> <realm>Shared and Menu</realm> <args> <arg name="name" type="string">Name of the <page>ConVar</page>. This cannot be a name of an engine console command or console variable. It will silently fail if it is. If it is the same name as another lua ConVar, it will return that ConVar object.</arg> <arg name="value" type="string">Default value of the convar. Can also be a number.</arg> <arg name="flags" type="number" default="FCVAR_NONE">Flags of the convar, see <page>Enums/FCVAR</page>, either as bitflag or as table.</arg> <arg name="helptext" type="string" default="">The help text to show in the console.</arg> <arg name="min" type="number" default="nil">If set, the ConVar cannot be changed to a number lower than this value.</arg> <arg name="max" type="number" default="nil">If set, the ConVar cannot be changed to a number higher than this value.</arg> </args> <rets> <ret name="" type="ConVar">The convar created.</ret> </rets> </function>