local monsters = {
["Dragon"] = {
{x = 9168, y = 8572, z = 7},
{x = 9175, y = 8558, z = 7},
{x = 9169, y = 8575, z = 7},
{x = 9172, y = 8556, z = 7},
{x = 9173, y = 8567, z = 7},
{x = 9161, y = 8566, z = 7},
{x = 9165, y = 8567, z = 7},
{x = 9163, y = 8557, z = 7},
{x = 9183, y = 8560, z = 7},
{x = 9181, y = 8566, z = 7},
{x = 9165, y = 8560, z = 7}
},
["Dragon Lord Hatchling"] = {
{x = 9169, y = 8568, z = 7},
{x = 9178, y = 8573, z = 7},
{x = 9182, y = 8570, z = 7},
{x = 9178, y = 8563, z = 7}
},
["Dragon Lord"] = {
{x = 9171, y = 8575, z = 7},
{x = 9184, y = 8557, z = 7},
{x = 9184, y = 8565, z = 7},
{x = 9177, y = 8556, z = 7},
{x = 9168, y = 8558, z = 7},
{x = 9165, y = 8555, z = 7},
{x = 9162, y = 8563, z = 7},
{x = 9175, y = 8575, z = 7},
{x = 9170, y = 8565, z = 7},
{x = 9169, y = 8562, z = 7},
{x = 9177, y = 8567, z = 7}
}
}
local walls = {
[{x = 9166, y = 8574, z = 7}] = 9166,
[{x = 9173, y = 8569, z = 7}] = 5278,
[{x = 9180, y = 8581, z = 7}] = 9165,
[{x = 9174, y = 8570, z = 7}] = 5282,
[{x = 9176, y = 8573, z = 7}] = 5282
}
local function checkFloor(fromPosition, toPosition)
for x = fromPosition.x, toPosition.x do
for y = fromPosition.y, toPosition.y do
local position = {x = x, y = y, z = fromPosition.z}
local creature = getTopCreature(position).uid
if creature.uid > 0 and isMonster(creature) then
return false
end
doCleanTile(position)
end
end
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local areaFrom = {x = 9155, y = 9552, z = 7}
local areaTo = {x = 9191, y = 8589, z = 7}
local areaFrom2 = {x = 9160, y = 8544, z = 6}
local areaTo2 = {x = 9188, y = 8583, z = 6}
if(checkFloor(areaFrom, areaTo) == false or checkFloor(areaFrom2, areaTo2) == false) then
return doPlayerSendCancel(cid, "Sorry, there are already monsters in arena.")
end
for monster, positions in pairs(monsters) do
for _, position in ipairs(positions) do
doCreateMonster(monster, position)
position.z = position.z - 1
doCreateMonster(monster, position)
end
end
doTransformItem(item.uid, (item.itemid == 1945 and 1946 or 1945))
for position, wall in pairs(walls) do
if getTileItemById(position, wall).uid == 0 then
doCreateItem(wall, position)
position = position.z - 1
doCreateItem(wall, position)
end
end
end
Pronto, acho que funciona. O botão ou alavanca irá sumonar e criar paredes nos dois andares.








info
Grupo: Artesão
Registrado: 10/11/11
Posts: 118
Reputação: +2
Eu não posso usar a mesma função (Docreateitem) em 2 scripts diferentes?
quando se usa este (script) funciona perfeitamente,
function onUse(cid, item, fromPosition, itemEx, toPosition) local monstros ={ {{x = 9168, y = 8572, z = 7}, "Dragon"}, {{x = 9175, y = 8558, z = 7}, "Dragon"}, {{x = 9169, y = 8575, z = 7}, "Dragon"}, {{x = 9172, y = 8556, z = 7}, "Dragon"}, {{x = 9173, y = 8567, z = 7}, "Dragon"}, {{x = 9161, y = 8566, z = 7}, "Dragon"}, {{x = 9165, y = 8567, z = 7}, "Dragon"}, {{x = 9163, y = 8557, z = 7}, "Dragon"}, {{x = 9183, y = 8560, z = 7}, "Dragon"}, {{x = 9181, y = 8566, z = 7}, "Dragon"}, {{x = 9165, y = 8560, z = 7}, "Dragon"}, {{x = 9171, y = 8575, z = 7}, "Dragon Lord"}, {{x = 9184, y = 8557, z = 7}, "Dragon Lord"}, {{x = 9184, y = 8565, z = 7}, "Dragon Lord"}, {{x = 9177, y = 8556, z = 7}, "Dragon Lord"}, {{x = 9168, y = 8558, z = 7}, "Dragon Lord"}, {{x = 9165, y = 8555, z = 7}, "Dragon Lord"}, {{x = 9162, y = 8563, z = 7}, "Dragon Lord"}, {{x = 9175, y = 8575, z = 7}, "Dragon Lord"}, {{x = 9170, y = 8565, z = 7}, "Dragon Lord"}, {{x = 9169, y = 8562, z = 7}, "Dragon Lord"}, {{x = 9177, y = 8567, z = 7}, "Dragon Lord"}, {{x = 9169, y = 8568, z = 7}, "Dragon Lord Hatchling"}, {{x = 9178, y = 8573, z = 7}, "Dragon Lord Hatchling"}, {{x = 9182, y = 8570, z = 7}, "Dragon Lord Hatchling"}, {{x = 9178, y = 8563, z = 7}, "Dragon Lord Hatchling"} } if SevenFloor() == false then return doPlayerSendCancel(cid, "sorry already have monster.") end for _, summon in pairs(monstros) do doCreateMonster(summon[2], summon[1]) end doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) local walls = {{x=9166, y=8574, z=7, stackpos=1},{x=9173, y=8569, z=7, stackpos=1},{x=9180, y=8581, z=7, stackpos=1},{x=9174, y=8570, z=7, stackpos=1},{x=9176, y=8573, z=7, stackpos=1}} local doors = {9166, 5278, 9165, 5282, 5282} for i=1, 5 do if getTileItemById(walls[i], doors[i]).uid > 0 then return false else doCreateItem(doors[i],1,walls[i]) end end function SevenFloor() local fromPosition,toPosition = {x = 9155, y = 8552, z = 7},{x = 9191, y = 8589, z = 7} -- começo e final da ára for x = fromPosition.x, toPosition.x do for y = fromPosition.y, toPosition.y do local pos = {x=x, y=y, z=fromPosition.z} local m = getTopCreature(pos).uid if m ~= 0 and isMonster(m) then return false end doCleanTile(pos) end end return true end endusar o segundo é o mesmo script, eu faço esse erro, basta alterar piso de 7 a 6 em docreateitem
function onUse(cid, item, fromPosition, itemEx, toPosition) local monstros ={ {{x = 9168, y = 8572, z = 6}, "Dragon"}, {{x = 9175, y = 8558, z = 6}, "Dragon"}, {{x = 9169, y = 8575, z = 6}, "Dragon"}, {{x = 9172, y = 8556, z = 6}, "Dragon"}, {{x = 9173, y = 8567, z = 6}, "Dragon"}, {{x = 9161, y = 8566, z = 6}, "Dragon"}, {{x = 9165, y = 8567, z = 6}, "Dragon"}, {{x = 9163, y = 8557, z = 6}, "Dragon"}, {{x = 9183, y = 8560, z = 6}, "Dragon"}, {{x = 9181, y = 8566, z = 6}, "Dragon"}, {{x = 9165, y = 8560, z = 6}, "Dragon"}, {{x = 9171, y = 8575, z = 6}, "Dragon Lord"}, {{x = 9184, y = 8557, z = 6}, "Dragon Lord"}, {{x = 9184, y = 8565, z = 6}, "Dragon Lord"}, {{x = 9177, y = 8556, z = 6}, "Dragon Lord"}, {{x = 9168, y = 8558, z = 6}, "Dragon Lord"}, {{x = 9165, y = 8555, z = 6}, "Dragon Lord"}, {{x = 9162, y = 8563, z = 6}, "Dragon Lord"}, {{x = 9175, y = 8575, z = 6}, "Dragon Lord"}, {{x = 9170, y = 8565, z = 6}, "Dragon Lord"}, {{x = 9169, y = 8562, z = 6}, "Dragon Lord"}, {{x = 9177, y = 8567, z = 6}, "Dragon Lord"}, {{x = 9169, y = 8568, z = 6}, "Dragon Lord Hatchling"}, {{x = 9178, y = 8573, z = 6}, "Dragon Lord Hatchling"}, {{x = 9182, y = 8570, z = 6}, "Dragon Lord Hatchling"}, {{x = 9178, y = 8563, z = 6}, "Dragon Lord Hatchling"} } if SixFloor() == false then return doPlayerSendCancel(cid, "sorry already have monster.") end for _, summon in pairs(monstros) do doCreateMonster(summon[2], summon[1]) end doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) local walls = {{x=9166, y=8574, z=6, stackpos=1},{x=9173, y=8569, z=6, stackpos=1},{x=9180, y=8581, z=6, stackpos=1},{x=9174, y=8570, z=6, stackpos=1},{x=9176, y=8573, z=6, stackpos=1}} local doors = {9166, 5278, 9165, 5282, 5282} for i=1, 5 do if getTileItemById(walls[i], doors[i]).uid > 0 then return false else doCreateItem(doors[i],1,walls[i]) end end function SixFloor() local fromPosition,toPosition = {x = 9160, y = 8554, z = 6},{x = 9188, y = 8583, z = 6} -- começo e final da ára for x = fromPosition.x, toPosition.x do for y = fromPosition.y, toPosition.y do local pos = {x=x, y=y, z=fromPosition.z} local m = getTopCreature(pos).uid if m ~= 0 and isMonster(m) then return false end doCleanTile(pos) end end return true end endo problema ocorre, acrescentando que estas linhas,
local walls = {{x=9166, y=8574, z=6, stackpos=1},{x=9173, y=8569, z=6, stackpos=1},{x=9180, y=8581, z=6, stackpos=1},{x=9174, y=8570, z=6, stackpos=1},{x=9176, y=8573, z=6, stackpos=1}} local doors = {9166, 5278, 9165, 5282, 5282} for i=1, 5 do if getTileItemById(walls[i], doors[i]).uid > 0 then return false else doCreateItem(doors[i],1,walls[i]) end endIsso é o erro que aparecem ou script
Espero que eu possa ajudar
Editado Julho 15 por beenii