Garry's Mod Wiki

Revision Difference

DMenu:AddCVar#554272

<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 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. It will have only one argument: <page>Panel</page> pnl - The created <page>DMenuOptionCVar</page></arg>. </args> <rets> <ret name="" type="Panel">The created <page>DMenuOptionCVar</page></ret> </rets> </function>