local t = {
create = {5787,1},
entrada = {
{x = 1057, y = 1005, z = 8, stackpos = 1},
{x = 1056, y = 1005, z = 8, stackpos = 1},
{x = 1055, y = 1005, z = 8, stackpos = 1},
{x = 1054, y = 1005, z = 8, stackpos = 1}
},
saida ={
{x = 1089, y = 563, z = 7},
{x = 1088, y = 563, z = 7},
{x = 1087, y = 563, z = 7},
{x = 1086, y = 563, z = 7}
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local check = {}
for _, k in ipairs(t.entrada) do
local x = getTopCreature(k).uid
if(isPlayer(x)) then
table.insert(check, x)
end
end
if(#check < 2) then
return doPlayerSendCancel(cid, 'Minimo 2 pessoas.')
end
for i, tid in ipairs(check) do
function remove()
if getTileItemById(t.entrada[i], t.create[1]).uid > 0 then
doRemoveItem(getThingfromPos(t.entrada[i]).uid,1)
end
end
doSendMagicEffect(t.entrada[i], CONST_ME_POFF)
doCreateItem(t.create[1], 1, t.entrada[i])
doTeleportThing(tid, t.saida[i], false)
setPlayerStorageValue(tid,t.storage,1)
doSendMagicEffect(t.saida[i], CONST_ME_ENERGYAREA)
addEvent(remove, t.create[2]*1000*60)
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return true
end
create = {5787,1},
5787 é o id do item
1 é o tempo em minutos que irá remover os items