Garry's Mod Wiki

Revision Difference

DMenu:AddCVar#513707

<function name="AddCVar" parent="DMenu" type="panelfunc">⤶ <ispanel>yes</ispanel>⤶ <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</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.&#xA;&#xA;It will have only one argument:&#xA;&lt;page&gt;Panel&lt;/page&gt; pnl - The created &lt;page&gt;DMenuOptionCVar.&lt;/page&gt;</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="Panel">The created <page>DMenuOptionCVar</page></ret>⤶ </rets>⤶ </function>⤶ ⤶