General > Developers Corner

Server redirecter

(1/2) > >>

cyborgguy123:
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)

JamminR:
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#

cyborgguy123:

--- Quote from: JamminR 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#

--- End quote ---
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

[0] Board index

Go to full version