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
26
27
28
29
30
31
32
pk = {
CanEnter = {120840}, -- usgn ID
SpawnTiles = {{50,50},{60,60}}, -- TileX & TileY
Player = {}
}
addhook("spawn","Spawning")
function Spawning(id)
	pk.Player[id] = {}
	pk.Player[id].x = player(id,"tilex")
	pk.Player[id].y = player(id,"tiley")
	for _,usgn in pairs (pk.CanEnter) do
		if player(id,"usgn") == usgn then
			RandomHouse = math.random(1,#pk.SpawnTiles)
			parse("setpos "..id.." "..pk.SpawnTiles[RandomHouse][1]*32+16 .." "..pk.SpawnTiles[RandomHouse][2]*32+16)
		end
	end
end
addhook("movetile","Moving")
function Moving(id,x,y)
	if entity(x,y,"name") == "NoEntry" or entity(x,y,"name") == "Impassable" or entity(x,y,"name") == "No" then
		for _,usgn in pairs (pk.CanEnter) do
			if player(id,"usgn") ~= usgn then
				parse("setpos "..id.." "..pk.Player[id].x*32+16 .." "..pk.Player[id].y*32+16)
				msg2(id,"You cannot enter this area!")
			end
		end
	end
	pk.Player[id].x = x
	pk.Player[id].y = y
end