Estou com dificuldade para criar um sistema de alavancas onde as duas precisam ser ativadas para que os players (4 players na frente de cada uma, estilo anihi) sejam teleportados. Abaixo ta a minha tentativa fracassada. Me ajudem por favor!
function onUse(cid, item, fromPos, itemEx, toPos)
local pos = {
p1 = {x=1042, y=1341, z=10}, -- posições dos jogadores antes da anihi
p2 = {x=1042, y=1342, z=10},
p3 = {x=1042, y=1343, z=10},
p4 = {x=1042, y=1344, z=10},
p5 = {x=1048, y=1341, z=10}, -- posições dos jogadores antes da anihi
p6 = {x=1048, y=1342, z=10},
p7 = {x=1048, y=1343, z=10},
p8 = {x=1048, y=1344, z=10},
top1 = {x=1070, y=1217, z=7}, -- posições para onde cada player irá na anihi
top2 = {x=1069, y=1217, z=7},
top3 = {x=1068, y=1217, z=7},
top4 = {x=1067, y=1217, z=7},
top5 = {x=1149, y=1218, z=7}, -- posições para onde cada player irá na anihi
top6 = {x=1150, y=1218, z=7},
top7 = {x=1151, y=1218, z=7},
top8 = {x=1152, y=1218, z=7},
}
local player1group1 = getTopCreature(pos.p1)
local player2group1 = getTopCreature(pos.p2)
local player3group1 = getTopCreature(pos.p3)
local player4group1 = getTopCreature(pos.p4)
local player1group2 = getTopCreature(pos.p5)
local player2group2 = getTopCreature(pos.p6)
local player3group2 = getTopCreature(pos.p7)
local player4group2 = getTopCreature(pos.p8)
if item.actionid == 8000 and item.itemid == 1945 then
if isPlayer(player1group1.uid) and isPlayer(player2group1.uid) and isPlayer(player3group1.uid) and isPlayer(player4group1.uid) then
local players = {[1] = player1group1.uid, [2] = player2group1.uid, [3] = player3group1.uid, [4] = player4group1.uid}
doTransformItem(item.uid, item.itemid+1)
return true
else
doPlayerSendCancel(cid, 'Você precisa de 4 players.')
end
elseif item.itemid == 1946 then
doTransformItem(item.uid, item.itemid-1)
return true
if item.actionid == 8001 and item.itemid == 1945 then
if isPlayer(player1group2.uid) and isPlayer(player2group2.uid) and isPlayer(player3group2.uid) and isPlayer(player4group2.uid) then
local players = {[1] = player1group2.uid, [2] = player2group2.uid, [3] = player3group2.uid, [4] = player4group2.uid}
doTeleportThing(player1.uid, pos.top1)
doSendMagicEffect(pos.top1,10)
doTeleportThing(player2.uid, pos.top2)
doSendMagicEffect(pos.top2,10)
doTeleportThing(player3.uid, pos.top3)
doSendMagicEffect(pos.top3,10)
doTeleportThing(player4.uid, pos.top4)
doSendMagicEffect(pos.top4,10)
doTeleportThing(player5.uid, pos.top5)
doSendMagicEffect(pos.top5,10)
doTeleportThing(player6.uid, pos.top6)
doSendMagicEffect(pos.top6,10)
doTeleportThing(player7.uid, pos.top7)
doSendMagicEffect(pos.top7,10)
doTeleportThing(player8.uid, pos.top8)
doSendMagicEffect(pos.top8,10)
doTransformItem(item.uid, item.itemid+1)
return true
else
doPlayerSendCancel(cid, 'Você precisa de 4 players.')
end
elseif item.itemid == 1946 then
doTransformItem(item.uid, item.itemid-1)
return true
end
return true
end
end