here is script i use , it works wery well but gave errors :|
these are the errors:
Lua:
local arena = {
frompos = { x = 168, y = 657, z = 7 },
topos = { x = 177, y = 666, z = 7 },
exit = { x = 169, y = 668, z = 6 }
}
local function exitArena(p)
local mana = (getCreatureMaxMana(p.cid) * 0.8)
doCreatureAddHealth(p.cid, getCreatureMaxHealth(p.cid))
doCreatureAddMana(p.cid, -mana)
doRemoveCondition(p.cid, CONDITION_INFIGHT)
doSendMagicEffect(p.exit, 10)
doTeleportThing(p.cid, p.exit, FALSE)
end
function onPrepareDeath(cid, killer)
if isInArea(getPlayerPosition(cid), arena.frompos, arena.topos) then
addEvent(exitArena, 100, {cid=cid, exit=arena.exit})
end
return TRUE
end
function isInArea(pos, fromPos, toPos)
if pos.x >= fromPos.x and pos.x <= toPos.x then
if pos.y >= fromPos.y and pos.y <= toPos.y then
if pos.z >= fromPos.z and pos.z <= toPos.z then
return true
end
end
end
return FALSE
end
these are the errors:
Lua:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath
luaGetCreatureMaxMana(). Creature not found
Lua:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath
luaGetCreatureMaxHealth(). Creature not found
Lua:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath
luaDoCreatureAddHealth(). Creature not found
Lua:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath
luaDoCreatureAddMana(). Creature not found
Lua:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath
luaDoRemoveCondition(). Creature not found
Lua:
Lua Script Error: [CreatureScript Interface]
in a timer event called from:
data/creaturescripts/scripts/arena.lua:onPrepareDeath
luaDoTeleportThing(). Thing not found