Panel/SetConVar

From Garry's Mod
Revision as of 14:32, 11 October 2019 by Argonium (Talk | contribs)
Jump to: navigation, search
 Panel:SetConVar( )

Contents

Description

WARNING

This function does not exist on all panels

WARNING

This function cannot interact with serverside convars unless you are host

Sets this panel's convar. When the convar changes this panel will update automatically.

For developer implementation, see Derma_Install_Convar_Functions.

Arguments

string convar

The console variable to check.

Examples

Example

Makes a checkbox linked to the sv_cheats convar.

local checkbox = vgui.Create( "DCheckBoxLabel", myFrame )
checkbox:SetConVar( "sv_cheats" )
checkbox:SetText( "Enable cheats?" )
checkbox:SetPos( 5, 25 )
checkbox:SizeToContents()

Output:

A checkbox which adapts to the value of the sv_cheats convar value. checkbox SetConVar.jpg
Personal tools
Navigation