1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
local portals = {}
addhook("startround", "startround_hook")
function startround_hook(mode)
	local id = 33
	for _, v in pairs(portals) do
		parse("triggerposition "..v[1][1].." "..v[1][2]) -- disabling func_teleport or disable it from editor with trigger_start
		parse("spawnobject 22 "..v[1][1].." "..v[1][2].." 0 0 0 "..id)
		parse("spawnobject 23 "..v[2][1].." "..v[2][2].." 0 0 0 "..id)
		id = id + 1
	end
end
for _, e in pairs(entitylist()) do
	local name = entity(e.x, e.y, "name")
	if entity(e.x, e.y, "type") == 70 and name == "portal" then
		portals[e.x..e.y] = {
			[1] = {e.x, e.y}, -- orange
			[2] = {entity(e.x, e.y, "int0"), entity(e.x, e.y, "int1")} -- blue
		}
	end
end
--startround_hook()