G.CreateConVar

From GMod Wiki

Revision as of 21:18, 18 February 2011 by Wizard (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax CreateConVar( String convar, String value [, Integer flags OR Table flagtable, String HelpText ] )
Where is this used?
Description:
Used for the creation of convars.
Returns: Convar
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.CreateConVar]G.CreateConVar [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThis example was pulled from server_settings.lua
Used onNewerServer.png
Code
// Load the config file
local f = file.Read( "../cfg/server_cfg.txt" )
 
// Put it in a table
Settings = util.KeyValuesToTable( f )
 
// Create the convars if they don't already exist
for k, v in pairs( Settings ) do
	if !ConVarExists( k ) then CreateConVar( k, v, FCVAR_NOTIFY ) end
end
 
Outputnone.


DescriptionThis example was pulled from constraint.lua.
Used onNewerServer.png
Code
CreateConVar( "gmod_physiterations", "2", { FCVAR_REPLICATED, FCVAR_ARCHIVE } )
Outputnone.


Additional Notes

SHARED | 0000000000000000 | 00000000000000000000000000000000 | NONE
SHARED | 0000000000000001 | 00000000000000000000000000000001 | UNREGISTERED
SHARED | 0000000000000002 | 00000000000000000000000000000010 | DEVELOPMENTONLY
SHARED | 0000000000000004 | 00000000000000000000000000000100 | GAMEDLL
SHARED | 0000000000000008 | 00000000000000000000000000001000 | CLIENTDLL
SHARED | 0000000000000032 | 00000000000000000000000000100000 | PROTECTED
SHARED | 0000000000000064 | 00000000000000000000000001000000 | SPONLY
SHARED | 0000000000000128 | 00000000000000000000000010000000 | ARCHIVE
SHARED | 0000000000000256 | 00000000000000000000000100000000 | NOTIFY
SHARED | 0000000000000512 | 00000000000000000000001000000000 | USERINFO
SHARED | 0000000000001024 | 00000000000000000000010000000000 | PRINTABLEONLY
SHARED | 0000000000002048 | 00000000000000000000100000000000 | UNLOGGED
SHARED | 0000000000004096 | 00000000000000000001000000000000 | NEVER_AS_STRING
SHARED | 0000000000008192 | 00000000000000000010000000000000 | REPLICATED
SHARED | 0000000000016384 | 00000000000000000100000000000000 | CHEAT
SHARED | 0000000000065536 | 00000000000000010000000000000000 | DEMO
SHARED | 0000000000131072 | 00000000000000100000000000000000 | DONTRECORD
SHARED | 0000000004194304 | 00000000010000000000000000000000 | NOT_CONNECTED
SHARED | 0000000016777216 | 00000001000000000000000000000000 | ARCHIVE_XBOX
SHARED | 0000000268435456 | 00010000000000000000000000000000 | SERVER_CAN_EXECUTE
SHARED | 0000000536870912 | 00100000000000000000000000000000 | SERVER_CANNOT_QUERY
SHARED | 0000001073741824 | 01000000000000000000000000000000 | CLIENTCMD_CAN_EXECUTE

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox