Author Topic: Server redirecter  (Read 4633 times)

0 Members and 1 Guest are viewing this topic.

Offline cyborgguy123

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Server redirecter
« on: April 07, 2017, 11:32:35 AM »
I have this code to redirect users to another server but it comes up with the error bad server address even though the IP is clearly valid.

Here is the code (note this is not my code before everyone here roasts me):

hook.Add( "PlayerSay", "Server Redirecter", function(ply, text)
   if (string.lower(text) == "!newserver" ) then
      ply:SendLua([[RunConsoleCommand("connect", "IP.ADRESS.GOES.HERE")]])
      return ""
   end
end)
« Last Edit: April 07, 2017, 11:41:50 AM by cyborgguy123 »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Server redirecter
« Reply #1 on: April 07, 2017, 12:15:05 PM »
From the two quick releases I found searching our forums for  examples of similar function code;
Server "Hopper" + Platform - https://forums.ulyssesmod.net/index.php/topic,8609.msg44234.html#msg44234
Simple hopper - https://forums.ulyssesmod.net/index.php/topic,8464.0.html

You're missing the port of the server IP
connect ip:port#
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline cyborgguy123

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Re: Server redirecter
« Reply #2 on: April 07, 2017, 12:22:30 PM »
From the two quick releases I found searching our forums for  examples of similar function code;
Server "Hopper" + Platform - https://forums.ulyssesmod.net/index.php/topic,8609.msg44234.html#msg44234
Simple hopper - https://forums.ulyssesmod.net/index.php/topic,8464.0.html

You're missing the port of the server IP
connect ip:port#
It still gives the same error with the port, and I don't want anything too complicated. I don't need derma panels or anything else. I just need a simple command to connect someone to a different server.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given