Server Name Fix

Post Reply
User avatar
ThatGuyNex
This is my homepage
This is my homepage
Posts: 239
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Tue May 28, 2013 12:23 pm

Server Name Fix

Post by ThatGuyNex »

With the Steam Pipe update, some people have been experiencing problems with default server names being loaded. I suspect this is an error with the patch that involves mounted games, and how which .cfg files are loaded upon initialization. I have created a quick and dirty "hotfix" lua file that should correct the issue, and will reload the server.cfg file after the gamemode has initialized. Unfortunately I do not have a server that is displaying the problem so I cannot verify 100% that this will work. It is the only workaround so far that I have seen however, and as far as I can tell it should work. Please try it and report back here on the results.

To use this code, create a .lua file in:

Code: Select all

garrysmod\lua\autorun\server\
Make the contents of the file this:

Code: Select all

function Init_Gamemode()
	MsgN("Attempting to fix Name Change Bug...")
	timer.Simple( 2, function()
		MsgN("Reloading server.cfg")
		ULib.execFile( "cfg/server.cfg", "GAME" )
	end)
end

hook.Add( "Initialize", "initializing", Init_Gamemode )
This requires ULib to be installed! If it is not already, it is available in the Easy Setup tab of your control panel.
User avatar
Edge100x
Founder
Founder
Posts: 12948
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Server Name Fix

Post by Edge100x »

Most of our mountable games (CS:S, HL2MP, TF2, DoD:S) don't include server.cfg files, interestingly.

Another possible workaround is to change the value of "servercfgfile" to something else, potentially causing the load to fail (if whatever mechanism is causing a different server.cfg to run is using the game's built-in system, it might respect this).
Post Reply