[英]Garry's Mod RunConsoleCommand() does not work correctly
I want to let some friends connect to my server just by clicking a simple button in the Garry's Mod menu. 我想让一些朋友通过单击Garry的Mod菜单中的简单按钮来连接到我的服务器。 To do that I have added some code to the mainmenu.lua file of Garry's mod.
为此,我向Garry的mod的mainmenu.lua文件中添加了一些代码。 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. 按钮和其他所有东西都起作用,只有
RunConsoleCommand("connect", "mycoolgmodserverip.com")
失败...在控制台中,我可以找到错误的Bad server address ("mycoolgmodserverip.com")
就像我键入connect "mycoolgmodserverip.com"
控制台中的connect "mycoolgmodserverip.com"
。 But I have to remove the quotes... It does not work with RunConsoleCommand("connect", 'mycoolgmodserverip.com')
too.. Do you have any idea? 但是我必须删除引号...它也无法与
RunConsoleCommand("connect", 'mycoolgmodserverip.com')
。您有任何想法吗?
According to the Garry's Mod source code , you may call JoinServer
in the menu state. 根据Garry的Mod源代码 ,您可以在菜单状态下调用
JoinServer
。
Examples: 例子:
JoinServer(address)
JoinServer("myepicserverip.com")
JoinServer(address)
JoinServer("myepicserverip.com")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.