Looking for a server re-director.

Hello! I have seen this on some servers before and have no clue if it’s custom but I will give you a quick rundown of how it looks.

Lets say I have two servers, one of them being the “Outlands” and another in a city. If a person walks up to a certain place in the map a menu comes up asking if they would like to move to the Outlands, the menu would have two options one being “Okay” and the other being “Cancel”. If you click okay you are brought to the servers and are allowed to enter. But if you try and join the “Outlands” server though the server browse menu it won’t allow you to join.

Now I have no idea if the servers I have seen this on have made it custom or if it is available somewhere. If not I’ll try and code it myself. :v:

just do a bound checking, and then send a net message to player so he run in client RunConsoleCommand(“connect”,<serverip>)

Or let the client do that instead of the server? Optimization and who cares if he faking his position, somehow.

Elaborate if you can.

The client can use the connect command whenever it wants. There’s no reason to do any networking between the server and client in this case, because the client already has control of which servers it can connect to in the first place - no matter where they are. So don’t bother sending unnecessary messages between the server and client.

Just check if the player is in the area you want and make your derma stuff appear, run the console command if they press okay. You can do this all client-side because there is really nothing to exploit.

Alright makes sense.

Also to the person who marked me dumb, if you want to code this please go ahead and do so, thanks.

– snip – It’s late and I didn’t read the OP thoroughly. RIP.

Yeah that’s not what Im looking for unfortunately. I need it so when the player walks into a gate in the map it asks if they want to be redirected to a surface map on a separate server.

Two possibilities exist:

  • It’s because you signed your post, which is frowned upon here, or
  • they saw “server redirector” and rated dumb as a kneejerk reaction. Are you familiar with the drama behind some popular server putting redirectors in every possible GeoIP region?

i prepar a scripte for you, wait a minute =D



if CLIENT then
	local TransferAreaPos = Vector(-3114.529785, -4923.948242, -13203.968750) -- use GetPos in your consol
	local Radius = 2000/19.05-- Circle (diameter value) area arount TransferAreaPos in meter 1m in real = 19.05 ingame units
	local Coef = ScrW()/1920 -- its a multiplicator that make a coef to addapte derma value for all screen resolution
	local ServIp = "192.168.1.200:27015"
	local ServMdp = ""
	
	function CreatDerma()
		local DermaFram = vgui.Create( "DFrame" )
			DermaFram:SetSize( 600*Coef, 200*Coef )
			DermaFram:SetPos( 660*Coef, 440*Coef )
			DermaFram:SetTitle( "Travel Zone" )
			DermaFram:SetVisible( true )
			DermaFram:SetDraggable( true )
			DermaFram:ShowCloseButton( true )
			DermaFram:MakePopup()

		local ShowText = vgui.Create( "DLabel", DermaFram )
			ShowText:SetFont("Trebuchet24")
			ShowText:SetText( [[
			Did you want to go outside ?
			]])
			ShowText:SetPos( 175*Coef,50*Coef )
			ShowText:SetTextColor( Color( 255, 255, 255 ) )
			ShowText:SizeToContents()
			
		local SpawnButtonYes = vgui.Create( "DButton", DermaFram )
			SpawnButtonYes:SetFont("Trebuchet24")
			SpawnButtonYes:SetTextColor( Color( 255, 255, 255 ) )
			SpawnButtonYes:SetSize(150*Coef,50*Coef)
			SpawnButtonYes:SetPos(20*Coef,100*Coef) 
			SpawnButtonYes:SetText( "Yes! Let's GO!")
			SpawnButtonYes.Paint = function( self, w, h ) draw.RoundedBox( 10, 0, 0, w, h, Color( 0, 200, 100, 250 ) ) end
			SpawnButtonYes.DoClick = function(ply) LocalPlayer():ConCommand("connect "..ServIp..";password "..ServMdp) end
		
		local SpawnButtonNo = vgui.Create( "DButton", DermaFram )
			SpawnButtonNo:SetFont("Trebuchet24")
			SpawnButtonNo:SetTextColor( Color( 255, 255, 255 ) )
			SpawnButtonNo:SetSize(150*Coef,50*Coef)
			SpawnButtonNo:SetPos(430*Coef,100*Coef) 
			SpawnButtonNo:SetText( "NONONooo !!!")
			SpawnButtonNo.Paint = function( self, w, h ) draw.RoundedBox( 10, 0, 0, w, h, Color( 255, 0, 0, 250 ) ) end
			SpawnButtonNo.DoClick = function(ply) DermaFram:Remove() end	
	
	end
	
	local TriggerStatus = "TriggerEnbale" -- Defin default var (you can rewite code to use Boolean if you want)
	
	function TransferArea()
		-- if we are close to TransferAreaPos then
		if ( TransferAreaPos:Distance( ply:GetPos() ) <= Radius  ) then
			--we check if system is on or off (to make a simili toggle trigger)
			-- it's is the case, call derma function ans disable the trigger (to ensure player arent block with an infiny derma loop)
			if ( TriggerStatus == "TriggerEnbale" ) then CreatDerma();TriggerStatus = "TriggerDisabled" end
		else
			-- if player exist TriggerArea, and if trigger is disabled, then we reactiv them for the next time.
			if ( TriggerStatus == "TriggerDisabled" ) then TriggerStatus = "TriggerEnbale" end
		end
	end
	hook.Add("Think","",TransferArea)
end


if you need to go to a server with password, this scripte is pretty unsafe ^^

you can simply add more zone without table :



if ( TransferAreaPos:Distance( ply:GetPos() ) <= Radius or TransferAreaPos2:Distance( ply:GetPos() ) <= Radius or TransferAreaPos3:Distance( ply:GetPos() ) <= Radius .............  ) then


Edite, you say Dumb ? so give us a code or say what. I juste try to help.

Its a sarcastic comment, obviously I’m in face punch and they gotta have that hair trigger on dumb :v:

[editline]5th November 2016[/editline]

So much dumb ratings in this thread omg

[editline]5th November 2016[/editline]

@nyhu It’s getting late so I’ll take a look at this tomorrow, thanks for your input though.

[editline]5th November 2016[/editline]

EDIT AGAIN, also the surface server would have a password on it

Idk If you expect anyone to make it for you randomly, Although easy to do.
But I don’t think anyone here will

Trust me I don’t. Will probably see if I can find the functions needed to make or hire someone to do it.

Yeah hire wtf am I thinking

Hire someone? What! There’s no need! What you’re asking for is extremely simple. Here’s something I wrote up real quick to get you started :smiley:



local min_box = Vector( 0, 0, 0 ) -- Bottom corner of box
local max_box = Vector( 100, 100, 100 ) -- Top corner of box
local server_ip = "192.168.1.1" -- server ip
local server_password = "password" -- server password

local serverframe

local function OpenConfirmation()
	-- basic derma stuff
	serverframe = vgui.Create( "DFrame" )
	serverframe:SetSize( 300, 150 )
	serverframe:MakePopup()
	serverframe:SetKeyBoardInputEnabled( false ) -- allow players to use their keyboard to move around, talk, etc
	serverframe:Center()
	serverframe:SetTitle( "Connect to other server?" )

	local frameanswer = vgui.Create( "DButton", serverframe )
	frameanswer:SetPos( 50, 50 )
	frameanswer:SetSize( 75, 50 )
	frameanswer:SetText( "Yes" )
	frameanswer.DoClick = function( s ) RunConsoleCommand( "password", server_password ) RunConsoleCommand( "connect", server_ip ) end -- runs the password and connect command

	local frameanswer = vgui.Create( "DButton", serverframe )
	frameanswer:SetPos( 175, 50 )
	frameanswer:SetSize( 75, 50 )
	frameanswer:SetText( "No" )
	frameanswer.DoClick = function( s ) serverframe:Remove() end

end

timer.Create( "check_forplayersinbox", 1, 0, function() -- creates a timer that runs every second
	local ents_in_box = ents.FindInBox( min_box, max_box ) -- finds all the ents within the box specified
	if ( #ents_in_box >= 1 ) then -- makes sure there's more than one entity
		for k, v in pairs( ents_in_box ) do -- loop through the entitys found
			if ( v == LocalPlayer() and not IsValid( serverframe ) ) then -- checks if the ent is the localplayer and doesn't have the question open
				OpenConfirmation() -- opens the question
			end
		end
	end
end )


Think of the box like this:

Just place it around your gate. Hope this helps :smiley:

i can’t express my gratitude towards you in a correct way that would explain how I feel, all I can say is thank you for using your valuable time on earth to help some idiot on the internet! Thanks man!

Even though it doesn’t matter too much here, you could compare the clients position to see if it’s within the box. No need to go looping through entities.

Maybe less reactiv than a “Think”, but need less ressources. I copy past your scripte to ma exemple base n_n (and this technique to make a Box ).
I can’t rate , but i say Thanks ^^

Alright one last thing before I end this thread, I put Moats code into a .lua named redirect.lua, in short I put it in my GMod Lua folder to test on a singleplayer server, when I do sv_allowcslua 1 and activate the script through console it says “Running script redirect.lua…” I don’t know if Im doing something wrong but it never actually executes.

Are you sure? The script only redirects you when you are within (0,0,0) to (100,100,100), which in flatgrass is way up in the sky (you can check your position with ‘getpos’ in console. X and Y are the ground plane, and Z is up-down. Think of it like god looking down on the map.)

Alright, I did get pos in the position I’d like and I get this



setpos 43.014866 1030.716064 -12735.968750;setang 33.942631 -91.378441 0.000000


I’m probably around 80% sure of which vectors to use, but would you mind telling me the correct ones to use? (I’m new if you haven’t noticed yet :v:)

EDIT: Never mind figured it out, thank you all for your help!

EDIT: Menu is popping up now, but strangely it’s printing “Bad server address” when I attempt to connect although that is the correct address of the server?