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
33
function checkwalkableframe(x,y,f)
	if tile(x,y,"walkable") and tile(x,y,"frame") == f then
		return 1
	end
	return 0
end
function initArray(m,v)
	local array = {}
	for i = 1, m do
		array[m] = v
	end
	return array
end
lastx = initArray(32,0)
lasty = initArray(32,0)
addhook("leave","resetvars")
function resetvars(i)
	lastx[i] = 0
	lasty[i] = 0
end
addhook("move","teleback")
function teleback(id,x,y)
	if checkwalkableframe(x,y,23) == 1 then
		parse("setpos "..id.." "..lastx[id].." "..lasty[id])
	else
		lastx[id] = x
		lasty[id] = y
	end
end