aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/mapstich/cl_mapstich.lua
blob: dbd332dc270168c2a4fc625c54c199bf444de0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--[[
	The client constantly cheks to see if we're in a serverchnage zone
]]
if not nrequire("sh_zones.lua") then return end
local log = nrequire("log.lua")
hook.Add("Think","artery_checklevelchange",function()
	local z
	pcall(function()
		z = LocalPlayer():GetCurrentZone()
	end,function()
		--This happens ocasionally when the player has loaded, and is running lua, but the LocalPlayer() entity isn't valid yet.
	end)
	--print("looks like i'm in zone",z)
	if z then
		net.Start("art_zonechange")
		net.SendToServer()
	end
end)

net.Receive("art_sendtoserver",function()
	local where = net.ReadString()
	log.debug("Being sent to another server:" .. where)
	--LocalPlayer():ConCommand("connect " .. where)
end)