local areas = { [1] = { fromPosition = {x = 93, y = 125, z = 7}, -- upper-left sqm toPosition = {x = 95, y = 127, z = 7}, -- lower-right sqm creatureName = {"Rat", "Cave Rat"} } } function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) local pass = true for _, area in ipairs(areas) do local x = {min = math.min(area.fromPosition.x, area.toPosition.x), max = math.max(area.fromPosition.x, area.toPosition.x)} local y = {min = math.min(area.fromPosition.y, area.toPosition.y), max = math.max(area.fromPosition.y, area.toPosition.y)} local width = ((x.max - x.min) / 2) + 1 local lenght = ((y.max - y.min) / 2) + 1 local center = {x = x.min + width, y = y.min + lenght, z = area.fromPosition.z} local specs = getSpectators(center, width, lenght, false) if specs then for _, cn in ipairs(specs) do if type(area.creatureName) == "table" and isInArray(area.creatureName, getCreatureName(cn)) then pass = false break elseif getCreatureName(cn):lower() == area.creatureName:lower() then pass = false break end end end end if pass == false then doPlayerSendCancel(cid, "Sorry, you need to kill all the monsters in the area to pass.") doTeleportThing(cid, fromPosition, true) return false end return true end
Agora da esse erro e nao trava o teleporte mesmo estando o bixo na area!
[18/01/2013 00:27:11] [Error - MoveEvents Interface] [18/01/2013 00:27:11] data/movements/scripts/travarespow.lua:onStepIn [18/01/2013 00:27:11] Description: [18/01/2013 00:27:11] data/movements/scripts/travarespow.lua:25: attempt to call method 'lower' (a nil value) [18/01/2013 00:27:11] stack traceback: [18/01/2013 00:27:11] data/movements/scripts/travarespow.lua:25: in function <data/movements/scripts/travarespow.lua:9>
Mesmo substituindo essa linha que vc disse nos posts acima
addEvent(doTeleportThing, 5, cid, fromPosition, true






info
Grupo: Conde
Registrado: 24/09/06
Posts: 512
Reputação: +369
local areas = { [1] = { fromPosition = {x = 93, y = 125, z = 7}, -- upper-left sqm toPosition = {x = 95, y = 127, z = 7}, -- lower-right sqm creatureName = {"Rat", "Cave Rat"} } } function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) local pass = true for _, area in ipairs(areas) do local x = {min = math.min(area.fromPosition.x, area.toPosition.x), max = math.max(area.fromPosition.x, area.toPosition.x)} local y = {min = math.min(area.fromPosition.y, area.toPosition.y), max = math.max(area.fromPosition.y, area.toPosition.y)} local width = ((x.max - x.min) / 2) + 1 local lenght = ((y.max - y.min) / 2) + 1 local center = {x = x.min + width, y = y.min + lenght, z = area.fromPosition.z} local specs = getSpectators(center, width, lenght, false) if specs then for _, cn in ipairs(specs) do if type(area.creatureName) == "table" and isInArray(area.creatureName, getCreatureName(cn)) then pass = false break elseif getCreatureName(cn):lower() == area.creatureName:lower() then pass = false break end end end end if pass == false then doPlayerSendCancel(cid, "Sorry, you need to kill all the monsters in the area to pass.") doTeleportThing(cid, fromPosition, true) return false end return true end