Garry's Mod Wiki

Revision Difference

DMenu:AddCVar#561501

<function name="AddCVar" parent="DMenu" type="panelfunc"> <description>Creates a <page>DMenuOptionCVar</page> and adds it as an option into the menu. Checking and unchecking the option will alter the given console variable's value.</description> <realm>Client and Menu</realm> <args> <arg name="strText" type="string">The text of the button</arg> <arg name="convar" type="string">The console variable to change</arg> <arg name="on" type="string">The value of the console variable to set when the option is checked</arg> <arg name="off" type="string">The value of the console variable to set when the option is unchecked</arg> <arg name="funcFunction" type="function" default="nil">If set, the function will be called every time the option is pressed/clicked/selected. <callback> <arg type="Panel" name="pnl">The created <page>DMenuOptionCVar</page>.</arg> <arg type="Panel" name="pnl">The <page>DMenuOptionCVar</page> that was clicked.</arg> </callback> </arg> </args> <rets> <ret name="" type="Panel">The created <page>DMenuOptionCVar</page></ret> </rets> </function>