aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/mapstich/cl_mapstich.lua
blob: 6f85eeb5d8e1d9bdcd8979810145c1fe7dc3a8eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--[[
	The client constantly cheks to see if we're in a serverchnage zone
]]
if not nrequire("sh_zones.lua") then return end
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()
	LocalPlayer():ConCommand("connect " .. where)
end)