Bug
New Member
- Joined
- Jan 7, 2011
- Messages
- 111
- Reaction score
- 1
Code:
local t = {
a = {
{x=26019, y=26454, z=7}, --TOP LEFT training monk spot pos
{x=26205, y=26454, z=7}, --TOP RIGHT training monk spot pos
{x=26205, y=26616, z=7} --last training monk spot
},
b = {
{6}, --tiles between trianing spots from north to south.
{5} --tiles between trianing spots from west to east.
}
}
local i, a, b, c, d, e = 0, t.a[1], t.a[2], t.a[3], t.b[1], t.b[2]
function onStepIn(cid, item, fromPosition, toPosition)
i = a
if isPlayer(cid) then
if getTopCreature(a).type == 1 then
check(cid, fromPosition)
else
doTeleportThing(cid, a)
end
end
a = i
i = 0
return TRUE
end
function check(w, s)
repeat
a.x = a.x+e
until a.x == b.x or a == c or getTopCreature(a).type ~= 1
if a.x == b.x then
a.y = a.y+d
check(w, s)
end
if getTopCreature(a).type == 1 then
doPlayerSendTextMessage(w, 21, 'Sorry, all training spots are occupied')
doTeleportThing(w, s)
else
doTeleportThing(w, a)
end
end