0
votes

I want to let some friends connect to my server just by clicking a simple button in the Garry's Mod menu. To do that I have added some code to the mainmenu.lua file of Garry's mod. The Button and all other things work, only the RunConsoleCommand("connect", "mycoolgmodserverip.com") fails... In the Console I can find the error Bad server address ("mycoolgmodserverip.com") like when I would type connect "mycoolgmodserverip.com" in the console. But I have to remove the quotes... It does not work with RunConsoleCommand("connect", 'mycoolgmodserverip.com') too.. Do you have any idea?

1
What error do you get from the single-quoted version? The same thing? And if you run connect "someserver.com" on the command line yourself you get the error with the quotes but connect someserver.com doesn't give you that error with the quotes (pick some string that triggers that Bad server address error to test with)? - Etan Reisner
connect "someserver.com" makes the same error and with single quotes too... it only works with connect someserver.com (without quotes), but how could I write that in my code? - Luca Schimweg
You see whichever of single or double quotes you used on the command line (or in RunConsoleCommand) in the error? Or does the error always use double quotes? - Etan Reisner

1 Answers

1
votes

According to the Garry's Mod source code, you may call JoinServer in the menu state.

Examples:

JoinServer(address) JoinServer("myepicserverip.com")