/*
==========================================================================
Copyright (C) 2008-2019 PixelTail Games LLC. All rights reserved.
This file is part of GMod Tower.
==========================================================================
*/

include( 'shared.lua' )

local function ConnectToServer( ip, port )

	print(ip, port)
	LocalPlayer():ConCommand( string.format("disconnect; connect %s:%d", ip, tonumber(port)) )

end

hook.Add( "InitPostEntity", "PromptForTower", function()

	Derma_Query( "GMod Tower is available online only. There is no single player or listen server support.\n\nDo you wish to join GMod Tower's server?\nIf yes - you will be connected to join.gmtower.org.\nIf no, you will remain on sandbox.", "Join GMod Tower?",
		"Yes", function()
			ConnectToServer( "join.gmtower.org", 27015 )
		end,
		"No", function() end
	)

end )