Qualquer bug é so fala.
É um movement:
.lua
-- Do not remove the credits --
-- [MOVEMENT] Porta que abre automáticamente --
-- Developed by Rigby (João Vitor) --
-- Xtibia.com --
local porta = {7777, 8888, 9999} -- porta fechada, porta meio aberta, porta aberta
local pos = {x = 1063, y = 1033, z = 7} -- local onde vai fica a porta
local delay = 100 -- ela vai demorar 0.1 segundos para fica totalmente aberta ou totalmente fechada
local action = 5555 -- action que ta no .xml, se muda la vai ter que muda aqui também
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if getTileItemById(pos, porta[1]).uid > 0 then
for i = 1, 2 do
addEvent(function()
doTransformItem(getTileItemById(pos, i == 1 and porta[1] or porta[2]).uid, porta[i + 1])
end, i * delay)
end
end
return true
end
function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local tab = {}
for _, pid in ipairs(getPlayersOnline()) do
if getTileInfo(getCreaturePosition(pid)).actionid == action then
table.insert(tab, pid)
end
end
if #tab == 0 then
if getTileItemById(pos, porta[3]).uid > 0 then
for i = 1, 2 do
addEvent(function()
doTransformItem(getTileItemById(pos, i == 1 and porta[3] or porta[2]).uid, porta[i == 1 and 2 or 1])
end, i * delay)
end
end
end
return true
end
.xml
<movevent type="StepIn" actionid="5555" event="script" value="Nomedoscript.lua"/>
<movevent type="StepOut" actionid="5555" event="script" value="Nomedoscript.lua"/>