Question about redirecting clients

Hey I’ve been having problems trying to redirect a client from my server to another server when they press a derma button.

I’ve tried almost every combination of making the client run “connect <ip>” in console but every time my tester says he just gets an error along the lines of the ip is wrong.

Does anyone know if it has to do with the fact that I’m on a listening server, or is it just impossible to redirect clients to another server without a module?

As far as I know, you can’t force a redirect like that.

[lua]
for k, v in pairs(player.GetAll()) do
v:SendLua(‘LocalPlayer():ConCommand(“connect 66.90.103.33:27090”)’)
end
[/lua]

Something like that works for me :wink: Obviously that’s a for loop to do it to everyone, so you’ll need to add something like that to your button.

Or you could just do
[lua]
v:ConCommand(“connect 66.90.103.33:27090”)
[/lua]

Ty jimbodude sending the lua made it work , as a note thegrb93 v:concommand will not work with connect command as it is blocked, it will work if your on a listening server and you, the host do it but if you want clients to be redirected you have to do what jimbodude posted, thanks again!

I don’t see why a command would be blocked serverside and not clientside.

It’s Valve’s way of protecting clients. Commands with the flag SERVER_CANNOT_EXECUTE will be blocked if run from the server, meaning they can only be run from the client. Valve didn’t take into account the server can run commands via lua, seen as no valve games have lua natively supported.