Ir para conteúdo
  • Cadastre-se

Posts Recomendados

tenho um script de anihi para 2 player queria edita para 1 player so  n precisa de 2 player so um
 
 
 
 
function getMonstersInArea(pos1,pos2)
local players = {}
if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z and pos2.z then
for a = pos1.x, pos2.x do
for b = pos1.y,pos2.y do
local pos = {x=a,y=b,z=pos1.z}
if isMonster(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
return players
else
return false
end
end
 
function getPlayersInArea(pos1,pos2)
local players = {}
if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z and pos2.z then
for a = pos1.x, pos2.x do
for b = pos1.y,pos2.y do
for z=pos1.z,pos2.z do
local pos = {x=a,y=b,z=z}
if isPlayer(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
end
return players
else
return false
end
end
 
function onUse(cid, item, fromPos, itemEx, toPos)
local pos = {
p1 = {x=35, y=1041, z=7}, -- posições dos jogadores antes da anihi
p2 = {x=35, y=1042, z=7},
 
anihi1 = {x=456, y=1317, z=7}, -- posições de início e fim da anihi (coloque um z=6 e outro z=7 e todos os números tem que ser em ordem crescente)
anihi2 = {x=468, y=1322, z=7},
top1 = {x=19, y=1053, z=7}, -- posições para onde cada player irá na anihi
top2 = {x=20, y=1053, z=7},
 
}
 
anihiStorage = 23602 -- storage pra checar se já fez a anihi (esse código não vai mudar, só nos baús)
 
local beezer = {
[1] = {x=44, y=1129, z=7}, -- posição de cada beezer
[2] = {x=45, y=1129, z=7},
[3] = {x=46, y=1129, z=7},
[4] = {x=47, y=1129, z=7},
[5] = {x=48, y=1129, z=7},
[6] = {x=49, y=1129, z=7},
}
 
local player1 = getTopCreature(pos.p1)
local player2 = getTopCreature(pos.p2)
 
 
if item.itemid == 1945 then
if isPlayer(player1.uid) and isPlayer(player2.uid)  then
local players = {[1] = player1.uid, [2] = player2.uid}
local playersInAnihi = getPlayersInArea(pos.anihi1, pos.anihi2)
local j = 0
if #playersInAnihi > 0 then
for _, pid in ipairs(players) do
doPlayerSendCancel(pid, 'You have to wait until another team clears off the room before you can enter.')
end
j = 1
end
if j == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
if getPlayerLevel(player1.uid) >= 250 and getPlayerLevel(player2.uid)  >= 250 then
local i = 0
for _,pid in ipairs(players) do
if getPlayerStorageValue(pid, anihiStorage) > -1 then
i = 1
for _,pad in ipairs(players) do
doPlayerSendCancel(pad, 'Someone in your team has already done this quest.')
end
break
end
end
if i == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
local monstersInAnihi = getMonstersInArea(pos.anihi1,pos.anihi2)
if #monstersInAnihi > 0 then
for _, monst in ipairs(monstersInAnihi) do
doRemoveCreature(monst)
end
end
for _, position in ipairs(beezer) do
doCreateMonster('beezer', position)
end
doTeleportThing(player1.uid, pos.top1)
doSendMagicEffect(pos.top1,10)
doTeleportThing(player2.uid, pos.top2)
doSendMagicEffect(pos.top2,10)
 
else
for _,pid in ipairs(players) do
if getPlayerLevel(pid) < 250 then
doPlayerSendCancel(pid, 'You have to be level 250 to enter this quest.')
else
doPlayerSendCancel(pid, 'Someone in your team is under level 250.')
end
end
end
else
doPlayerSendCancel(cid, 'You need 2 players for this quest.')
end
doTransformItem(item.uid, item.itemid+1)
return true
elseif item.itemid == 1946 then
doTransformItem(item.uid, item.itemid-1)
return true
end
return true
end

Link para o post
Compartilhar em outros sites

Tenta assim:

function getMonstersInArea(pos1)
local players = {}
if pos1.x and pos1.y and pos1.z then
for a = pos1.x do
for b = pos1.y do
local pos = {x=a,y=b,z=pos1.z}
if isMonster(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
return players
else
return false
end
end
 
function getPlayersInArea(pos1)
local players = {}
if pos1.x and pos1.y and pos1.z then
for a = pos1.x do
for b = pos1.y do
for z=pos1.z do
local pos = {x=a,y=b,z=z}
if isPlayer(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
end
return players
else
return false
end
end
 
function onUse(cid, item, fromPos, itemEx, toPos)
local pos = {
p1 = {x=35, y=1041, z=7}, -- posições dos jogadores antes da anihi
 
anihi1 = {x=456, y=1317, z=7}, -- posições de início e fim da anihi (coloque um z=6 e outro z=7 e todos os números tem que ser em ordem crescente)
anihi2 = {x=468, y=1322, z=7},
top1 = {x=19, y=1053, z=7}, -- posições para onde cada player irá na anihi
 
}
 
anihiStorage = 23602 -- storage pra checar se já fez a anihi (esse código não vai mudar, só nos baús)
 
local beezer = {
[1] = {x=44, y=1129, z=7}, -- posição de cada beezer
[2] = {x=45, y=1129, z=7},
[3] = {x=46, y=1129, z=7},
[4] = {x=47, y=1129, z=7},
[5] = {x=48, y=1129, z=7},
[6] = {x=49, y=1129, z=7},
}
 
local player1 = getTopCreature(pos.p1)
 
 
if item.itemid == 1945 then
if isPlayer(player1.uid) then
local players = {[1] = player1.uid}
local playersInAnihi = getPlayersInArea(pos.anihi1, pos.anihi2)
local j = 0
if #playersInAnihi > 0 then
for _, pid in ipairs(players) do
doPlayerSendCancel(pid, 'You have to wait until another team clears off the room before you can enter.')
end
j = 1
end
if j == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
if getPlayerLevel(player1.uid) >= 250 then
local i = 0
for _,pid in ipairs(players) do
if getPlayerStorageValue(pid, anihiStorage) > -1 then
i = 1
for _,pad in ipairs(players) do
doPlayerSendCancel(pad, 'Someone in your team has already done this quest.')
end
break
end
end
if i == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
local monstersInAnihi = getMonstersInArea(pos.anihi1,pos.anihi2)
if #monstersInAnihi > 0 then
for _, monst in ipairs(monstersInAnihi) do
doRemoveCreature(monst)
end
end
for _, position in ipairs(beezer) do
doCreateMonster('beezer', position)
end
doTeleportThing(player1.uid, pos.top1)
doSendMagicEffect(pos.top1,10)
 
else
for _,pid in ipairs(players) do
if getPlayerLevel(pid) < 250 then
doPlayerSendCancel(pid, 'You have to be level 250 to enter this quest.')
else
doPlayerSendCancel(pid, 'Someone in your team is under level 250.')
end
end
end
else
doPlayerSendCancel(cid, 'You need 1 player for this quest.')
end
doTransformItem(item.uid, item.itemid+1)
return true
elseif item.itemid == 1946 then
doTransformItem(item.uid, item.itemid-1)
return true
end
return true
end

 

Edit: Se não der certo, tenta esse:

function getMonstersInArea(pos1)
local players = {}
if pos1.x and pos1.y and pos1.z then
for a = pos1.x do
for b = pos1.y do
local pos = {x=a,y=b,z=pos1.z}
if isMonster(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
return players
else
return false
end
end
 
function getPlayersInArea(pos1)
local players = {}
if pos1.x and pos1.y and pos1.z then
for a = pos1.x do
for b = pos1.y do
for z=pos1.z do
local pos = {x=a,y=b,z=z}
if isPlayer(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
end
return players
else
return false
end
end
 
function onUse(cid, item, fromPos, itemEx, toPos)
local pos = {
p1 = {x=35, y=1041, z=7}, -- posições dos jogadores antes da anihi
 
anihi1 = {x=456, y=1317, z=7}, -- posições de início e fim da anihi (coloque um z=6 e outro z=7 e todos os números tem que ser em ordem crescente)
top1 = {x=19, y=1053, z=7}, -- posições para onde cada player irá na anihi
 
}
 
anihiStorage = 23602 -- storage pra checar se já fez a anihi (esse código não vai mudar, só nos baús)
 
local beezer = {
[1] = {x=44, y=1129, z=7}, -- posição de cada beezer
[2] = {x=45, y=1129, z=7},
[3] = {x=46, y=1129, z=7},
[4] = {x=47, y=1129, z=7},
[5] = {x=48, y=1129, z=7},
[6] = {x=49, y=1129, z=7},
}
 
local player1 = getTopCreature(pos.p1)
 
 
if item.itemid == 1945 then
if isPlayer(player1.uid) then
local players = {[1] = player1.uid}
local playersInAnihi = getPlayersInArea(pos.anihi1)
local j = 0
if #playersInAnihi > 0 then
for _, pid in ipairs(players) do
doPlayerSendCancel(pid, 'You have to wait until another team clears off the room before you can enter.')
end
j = 1
end
if j == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
if getPlayerLevel(player1.uid) >= 250 then
local i = 0
for _,pid in ipairs(players) do
if getPlayerStorageValue(pid, anihiStorage) > -1 then
i = 1
for _,pad in ipairs(players) do
doPlayerSendCancel(pad, 'Someone in your team has already done this quest.')
end
break
end
end
if i == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
local monstersInAnihi = getMonstersInArea(pos.anihi1)
if #monstersInAnihi > 0 then
for _, monst in ipairs(monstersInAnihi) do
doRemoveCreature(monst)
end
end
for _, position in ipairs(beezer) do
doCreateMonster('beezer', position)
end
doTeleportThing(player1.uid, pos.top1)
doSendMagicEffect(pos.top1,10)
 
else
for _,pid in ipairs(players) do
if getPlayerLevel(pid) < 250 then
doPlayerSendCancel(pid, 'You have to be level 250 to enter this quest.')
else
doPlayerSendCancel(pid, 'Someone in your team is under level 250.')
end
end
end
else
doPlayerSendCancel(cid, 'You need 1 player for this quest.')
end
doTransformItem(item.uid, item.itemid+1)
return true
elseif item.itemid == 1946 then
doTransformItem(item.uid, item.itemid-1)
return true
end
return true
end

Editado por danihcv (veja o histórico de edições)

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Link para o post
Compartilhar em outros sites

nos 2 deu esse erro ae assim q abri server e uso alavanca aparece nd

[11/12/2014 19:51:06] [Error - LuaScriptInterface::loadFile] data/actions/scripts/vocationquest.lua:4: ',' expected near 'do'
[11/12/2014 19:51:06] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/vocationquest.lua)
[11/12/2014 19:51:06] data/actions/scripts/vocationquest.lua:4: ',' expected near 'do'
Link para o post
Compartilhar em outros sites

Não sei se vai funcionar, mas tenta esse:

function getMonstersInArea(pos1)
local players = {}
if pos1.x and pos1.y and pos1.z then
for a = pos1.x, do
for b = pos1.y, do
local pos = {x=a,y=b,z=pos1.z}
if isMonster(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
return players
else
return false
end
end
 
function getPlayersInArea(pos1)
local players = {}
if pos1.x and pos1.y and pos1.z then
for a = pos1.x do
for b = pos1.y do
for z=pos1.z do
local pos = {x=a,y=b,z=z}
if isPlayer(getTopCreature(pos).uid) then
table.insert(players,getTopCreature(pos).uid)
end
end
end
end
return players
else
return false
end
end
 
function onUse(cid, item, fromPos, itemEx, toPos)
local pos = {
p1 = {x=35, y=1041, z=7}, -- posições dos jogadores antes da anihi
 
anihi1 = {x=456, y=1317, z=7}, -- posições de início e fim da anihi (coloque um z=6 e outro z=7 e todos os números tem que ser em ordem crescente)
anihi2 = {x=468, y=1322, z=7},
top1 = {x=19, y=1053, z=7}, -- posições para onde cada player irá na anihi
 
}
 
anihiStorage = 23602 -- storage pra checar se já fez a anihi (esse código não vai mudar, só nos baús)
 
local beezer = {
[1] = {x=44, y=1129, z=7}, -- posição de cada beezer
[2] = {x=45, y=1129, z=7},
[3] = {x=46, y=1129, z=7},
[4] = {x=47, y=1129, z=7},
[5] = {x=48, y=1129, z=7},
[6] = {x=49, y=1129, z=7},
}
 
local player1 = getTopCreature(pos.p1)
 
 
if item.itemid == 1945 then
if isPlayer(player1.uid) then
local players = {[1] = player1.uid}
local playersInAnihi = getPlayersInArea(pos.anihi1, pos.anihi2)
local j = 0
if #playersInAnihi > 0 then
for _, pid in ipairs(players) do
doPlayerSendCancel(pid, 'You have to wait until another team clears off the room before you can enter.')
end
j = 1
end
if j == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
if getPlayerLevel(player1.uid) >= 250 then
local i = 0
for _,pid in ipairs(players) do
if getPlayerStorageValue(pid, anihiStorage) > -1 then
i = 1
for _,pad in ipairs(players) do
doPlayerSendCancel(pad, 'Someone in your team has already done this quest.')
end
break
end
end
if i == 1 then
doTransformItem(item.uid, item.itemid+1)
return true
end
local monstersInAnihi = getMonstersInArea(pos.anihi1,pos.anihi2)
if #monstersInAnihi > 0 then
for _, monst in ipairs(monstersInAnihi) do
doRemoveCreature(monst)
end
end
for _, position in ipairs(beezer) do
doCreateMonster('beezer', position)
end
doTeleportThing(player1.uid, pos.top1)
doSendMagicEffect(pos.top1,10)
 
else
for _,pid in ipairs(players) do
if getPlayerLevel(pid) < 250 then
doPlayerSendCancel(pid, 'You have to be level 250 to enter this quest.')
else
doPlayerSendCancel(pid, 'Someone in your team is under level 250.')
end
end
end
else
doPlayerSendCancel(cid, 'You need 1 player for this quest.')
end
doTransformItem(item.uid, item.itemid+1)
return true
elseif item.itemid == 1946 then
doTransformItem(item.uid, item.itemid-1)
return true
end
return true
end

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo