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?
According to the Garry's Mod source code , you may call JoinServer
in the menu state.
Examples:
JoinServer(address)
JoinServer("myepicserverip.com")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.