Pivity

Server Redirect

Last read Never
#1

Hey there, im no lua brainiac, but i could use someone to help me with this.

Our community recently moved to another hosting and our old hosting will still be up for a week or so. How could i redirect players when they join old server/hosting to get instantly redirected to another server/ip? I've found some lua codes but they are old and don't do jackshit.

I could really use help with this.

Best regards.

#2

Can't you ply:ConCommand("connect ip") on the earliest possible hook with Player object as an argument?

Dumb x 2
#3
if SERVER then
AddCSLuaFile()
elseif CLIENT then
hook.Add( "InitPostEntity", "Auto-Redirect", function() LocalPlayer():ConCommand( "connect ip:port" ) end )
end

Credit to Flapadar on FacePunch.

Agree x 1Winner x 1
#4

Sorry to bring this thread back to life, but where would I put that piece of code?

Dumb x 3Funny x 1Friendly x 1
#5
ByGHETTOMICKEYMOUSE - EscaladeRPat 19th of June 2018 21:29:08
Sorry to bring this thread back to life, but where would I put that piece of code?

stop doing negromancy dude

Funny x 2Agree x 1Optimistic x 1Dumb x 1
#6
ByGHETTOMICKEYMOUSE - EscaladeRPat 19th of June 2018 21:29:08
Sorry to bring this thread back to life, but where would I put that piece of code?

../garrysmod/lua/autorun/ Make a file called redirect.lua, paste this code in:

if SERVER then
AddCSLuaFile()
elseif CLIENT then
hook.Add( "InitPostEntity", "Auto-Redirect", function() LocalPlayer():ConCommand( "connect ip:port" ) end )
end

Make sure you edit the ip:port to something like 127.0.0.1:27015 (Whatever your server IP is)

Agree x 2Winner x 1Dumb x 1
Users viewing this thread
Nobody