;On map exit

If GetUserDirection(#USERID) = #DIR_UP
	Direction = 1
Endif
If GetUserDirection(#USERID) = #DIR_RIGHT
	Direction = 2
Endif
If GetUserDirection(#USERID) = #DIR_DOWN
	Direction = 3
Endif
If GetUserDirection(#USERID) = #DIR_LEFT
	Direction = 4
Endif

SetUserFlag(#MAPID,52,#USERID)
SetUserFlag(#MAPID,53,Direction)








;Last map the player was on
SetUserFlag(#USERID,41,#MAPID)

;Take all items away that the user shouldn't move from maps.


Continue = 1