Author Topic: JoinServer  (Read 1765 times)

0 Members and 2 Guests are viewing this topic.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
JoinServer
« on: April 15, 2015, 01:29:29 PM »
Ok so i found this.... http://wiki.garrysmod.com/page/Global/JoinServer

this does not work as it is "a nil value"

How do i define this so it will connect a player to a different server?

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: JoinServer
« Reply #1 on: April 15, 2015, 02:18:00 PM »
I'm not entirely sure JoinServer works as advertised.  I can't seem to get it to respond to anything.

In terms of connecting to a specific server,  you can use the following:

LocalPlayer():ConCommand("connect ip:port")

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: JoinServer
« Reply #2 on: April 15, 2015, 05:30:59 PM »
I'll try this this! Thanks!

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: JoinServer
« Reply #3 on: April 16, 2015, 02:27:30 PM »
This works! Thanks! Hey why wont: RunConsoleCommand( "connect", "ip:port" ) work?

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: JoinServer
« Reply #4 on: April 16, 2015, 02:52:08 PM »
I believe it has to do with RunConsoleCommand putting quotes around each argument.  The connect command functions really weird, where you can't have quotes around the whole thing and you cannot have any additional spaces (or arguments) in the command either.  It just has to be connect ip:port with nothing extra.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: JoinServer
« Reply #5 on: April 16, 2015, 03:58:30 PM »
I believe it has to do with RunConsoleCommand putting quotes around each argument.  The connect command functions really weird, where you can't have quotes around the whole thing and you cannot have any additional spaces (or arguments) in the command either.  It just has to be connect ip:port with nothing extra.

Ah thanks!