Garry's Mod Wiki

Revision Difference

Global.UpdateServerSettings#548492

<function name="UpdateServerSettings" parent="Global" type="libraryfunc">⤶ <description>⤶ <internal>Called from JS when starting a new game</internal>⤶ Updates the Server Settings when called.⤶ </description>⤶ <realm>Menu</realm>⤶ <file line="150-L180">lua/menu/mainmenu.lua</file>⤶ </function>⤶ ⤶ <example>⤶ <description>Updating the Server Setting manually</description>⤶ <code>⤶ if !pnlMainMenu then return end -- pnlMainMenu is the Main Menu panel. (https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/menu//garrysmod/lua/menu/mainmenu.lua#L468)⤶ ⤶ local settings = {⤶ hostname = "Example",⤶ sv_lan = 0,⤶ p2p_enabled = 1,⤶ }⤶ ⤶ pnlMainMenu:Call( "UpdateServerSettings(" .. util.TableToJSON( settings ) .. ")" )⤶ </code>⤶ <output>⤶ <image src="https://i.imgur.com/k7cdnq7.png"/>⤶ <note>Only the given settings will be displayed and the gamemode settings will be hidden!</note>⤶ </output>⤶ </example>