Hello, I'm really new to this API. But i'm familiar with lua... but.. I'm trying to get client to connect to a different server by typing a command, which.. hasn't been doing anything which is concerning me.
Code:
and my config file:Code:elseif(args[0] == "join")then for k, v in pairs(self.Config.Servers)do if(v["servername"] == args[1])then rust.RunClientCommand(player, "disconnect") rust.RunClientCommand(player, "client.connect " .. v["ip"] .. ":" .. v["port"]) else rust.SendChatMessage(player, self.Config.Settings.Prefix .. "Sorry, that server is not in existance!\n ".. "Try `/hub list`!") end end
There's much more code to the plugin, but i'm not going to show it.Code:"Servers": [ { "ip": "127.0.0.1", "port": "28017", "servername": "RadControl" }, { "ip": "127.0.0.1", "port": "28019", "servername": "SurvivalN" }, { "ip": "127.0.0.1", "port": "28019", "servername": "SurvivalF" }, { "ip": "127.0.0.1", "port": "28019", "servername": "GunGame" }, { "ip": "127.0.0.1", "port": "28019", "servername": "Sandbox" }, { "ip": "127.0.0.1", "port": "28019", "servername": "RustyRP" } ],
Thanks for your help!
Solved Redirecting players to another server?
Discussion in 'Rust Development' started by xrayhunter, Dec 29, 2015.
-
Wulf Community Admin
You can't run a command on a player that isn't connected anymore, so this will not work. I'm sure there are other ways, but you'll need to be careful as to not cause your server to get blacklisted for redirecting.
-
Hmm... I thought it could get last remembered commands...
And i think the Rust Developers disabled Servers doing clientside commands like "client.connect iport" and "disconnect"
I wish there's a way to redirect people.
[DOUBLEPOST=1451366496][/DOUBLEPOST]Unless you have any ideas?
[DOUBLEPOST=1451366608][/DOUBLEPOST]Servers getting blacklisted for redirection? Really, i was going to make a hub system.. but.. i guess that's a waste of time then.. -
Wulf Community Admin
As for the blacklisting, it's generally there for handling servers that pretend to be one server, then redirect the players to another. I'm not saying you would be for sure, I'm just saying be careful. -
Alrighty, yeah. I understand, why they would blacklist those servers. I was kinda wondering could you do "disconnect; client.connect IP : Port"(Trying avoid the emotes)?
Why i was thinking that was because, I recently came from the Garry's Mod modding community.
And i don't know nor i have tried multi commands, in one command.
If you don't know what ";" means, its a splitter from command A to B, and it will run both as one basically.
[DOUBLEPOST=1451368198][/DOUBLEPOST]Also, your response time is awesome! Any other Modding Discussion are horrible to ask questions on to get responses and fix your issues with your development projects. -
Wulf Community Admin
-
Ahh.. Thats kinda sucks, Well thanks for you help!
+1 rep Wulf(I don't know how to give you reputation) -
-
All this sounds pretty shady IMHO, as a player I wouldn't want servers issuing client commands on my behalf. You should do one of two things, in your server description mention the server they should connect to. Or for your server address give out a domain name like RustyXRayHunter.com and just change what IP it points to if you need to change servers.
-
I've also once tried to create a command for users, so they could connect to our minigame server.
The Server can make the client run a command (like chat.add etc.), but client.connect etc. isn't working. -
client.connect doesnt work while connected to a server. you need to be disconnected first other then that you get the error already connected to server
-
Try bind ))
-
-
Other ways to do a redirect - no