LucasFerraz
Systems Analyst
Lever
LUA:
local from={x=33222, y=31693, z=14} --area
local to={x=33240, y=31701, z=14} --area
local summon={
{x=33224, y=31695, z=14}, --summon 1 pos
{x=33226, y=31695, z=14},
{x=33228, y=31697, z=14},
{x=33229, y=31697, z=14},
{x=33227, y=31699, z=14},
{x=33225, y=31699, z=14}
}
local playerA={
{x=33224, y=31671, z=13}, -- pos player 1 outside
{x=33223, y=31671, z=13},
{x=33222, y=31671, z=13},
{x=33221, y=31671, z=13}
}
local playerB={
{x=33227, y=31697, z=14}, -- pos player 1 inside
{x=33226, y=31697, z=14},
{x=33225, y=31697, z=14},
{x=33224, y=31697, z=14}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = {}
if item.itemid == 1945 then
for i = 1, 4 do
t[i]=getTopCreature(playerA[i]).uid
if t[i] == 0 or not isPlayer(t[i]) then
return doPlayerSendCancel(cid, 'You need 4 players for this quest.')
elseif getPlayerLevel(t[i]) < 100 then
return doPlayerSendCancel(cid, 'All players need to have level 100 or higher.')
end
end
for i = 1, 6 do
doCreateMonster('Demon', summon[i])
end
for i=1, 4 do
doTeleportThing(t[i], playerB[i])
doSendMagicEffect(playerA[i], CONST_ME_POFF)
doSendMagicEffect(playerB[i], CONST_ME_ENERGYAREA)
end
else
for x = from.x, to.x do
for y = from.y, to.y do
local v = getTopCreature({x=x, y=y, z=from.z}).uid
if v ~= 0 then
if isPlayer(v) then
return doPlayerSendCancel(cid, 'There is already a team in the quest room.')
elseif isMonster(v) then
table.insert(t, v)
end
end
end
end
for i = 1, #t do
doRemoveCreature(t[i])
end
end
return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end