Ir para conteúdo
  • Cadastre-se

(Resolvido)Erro Ao Dar Use na Bandeira AJUDA


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

amigos do tibiaking, o evento está funcionando perfeito. dar o premio abre normal. so tem um erro na minha distro quando os players matam todos do battle field eventos. e quando vai clicar na bandeira. para terminar eventos ok ela leva por templo recebe a recompensa mais dar um erro na distro

 

 

[Error - Action Interface]
data/actions/scripts/battlefield.lua:onUse
Description:
(luaDoRemoveItem) Item not found

 

 

data/actions/scripts/battleflield.lua

 

function onUse(cid, item, fromPosition, itemEx, toPosition)

local team = getPlayerStorageValue(cid, battlefield.storage2)

if (item.actionid == 45001 and team == 1) or (item.actionid == 45002 and team == 2) then
    getWinnersBattle(team)
end

return true
end

 

 

 

Lib/battlefield

 

battlefield = {
    Time_To_Start_Event = 3, -- Tempo em minutos
    TeleportAID = 45000,
    Min_Players = 2,
    Max_Players = 40,
    storage = 201206300801,
    storage2 = 201206300802,
    tpPos = {x=283, y=225, z=8},
    pos_team_1 = {x=2159,y=557,z=7},
    pos_team_2 = {x=2192,y=556,z=7},
    spectors = {{x=2167,y=549,z=6},{x=2167,y=564,z=6},{x=2183,y=549,z=6},{x=2183,y=563,z=6}},
    team1Name = "Black Assassins",
    team2Name = "Red Barbarians",    
}

function doBroadCastBattle(type,msg)
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then
            doPlayerSendTextMessage(cid,type,msg) 
        end 
    end
    return true 
end

function removeTp()
    local t = getTileItemById(battlefield.tpPos, 1387)
    if t then
        doRemoveItem(t.uid, 1)
        doSendMagicEffect(battlefield.tpPos, CONST_ME_POFF)
    end
end

function startBattlefield()
    if getGlobalStorageValue(battlefield.storage) ~= 0 then
        removeTp()
        if (battlefield.Max_Players - getGlobalStorageValue(battlefield.storage)) >= battlefield.Min_Players then
            doBroadcastMessage("[BATTLEFIELD] o evento vai começar em 1 minuto, crie sua estrategia.")
            addEvent(doBroadcastMessage, 60 * 1000, "[BATTLEFIELD] o evento começou.")
            addEvent(OpenWallBattle, 60 * 1000)
        else
            doBroadcastMessage("[BATTLEFIELD] o evento não começou por falta de players.")
            for _, cid in pairs(getPlayersOnline()) do
                if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then 
                    setPlayerStorageValue(cid, battlefield.storage2, -1)
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                end
            end
        end
    end
end

function OpenWallBattle()
    local x = true
    local B  = { 
        [1] = {1056,{x=2175, y=555, z=6, stackpos = 1}},   
        [2] = {1056,{x=2175, y=556, z=6, stackpos = 1}},
        [3] = {1056,{x=2175, y=557, z=6, stackpos = 1}},
        [4] = {1056,{x=2175, y=558, z=6, stackpos = 1}}   
        } 

    for i = 1, #B do
        if getTileItemById(B[2], B[1]).uid == 0 then 
            x = false 
        end
        if x == true then
            doRemoveItem(getThingfromPos(B[2]).uid,1)
        else
            doCreateItem(B[1], 1, B[2]) 
        end
    end
end

function getWinnersBattle(storage)
    local team = storage == 1 and battlefield.team1Name or battlefield.team2Name
    doBroadcastMessage("Jogadores do time ".. team .." ganharam o battlefield, eles receberão um Premio.")
    setGlobalStorageValue(battlefield.storage, -1)
    removeTp()
    OpenWallBattle()
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then 
            doRemoveCondition(cid, CONDITION_OUTFIT)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            if getPlayerStorageValue(cid, battlefield.storage2) == storage then
                doPlayerAddItem(cid,12715,15)
                doPlayerAddItem(cid,12701,1)
                doPlayerAddItem(cid,12734,3)
            end
            setPlayerStorageValue(cid, battlefield.storage2, -1)
        end
    end
end

 

 

 

me ajudem porfavor :/

Editado por wesleyrush18 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução
Spoiler

battlefield = {
    Time_To_Start_Event = 3, -- Tempo em minutos
    TeleportAID = 45000,
    Min_Players = 2,
    Max_Players = 40,
    storage = 201206300801,
    storage2 = 201206300802,
    tpPos = {x=283, y=225, z=8},
    pos_team_1 = {x=2159,y=557,z=7},
    pos_team_2 = {x=2192,y=556,z=7},
    spectors = {{x=2167,y=549,z=6},{x=2167,y=564,z=6},{x=2183,y=549,z=6},{x=2183,y=563,z=6}},
    team1Name = "Black Assassins",
    team2Name = "Red Barbarians",    
}

function doBroadCastBattle(type,msg)
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then
            doPlayerSendTextMessage(cid,type,msg) 
        end 
    end
    return true 
end

function removeTp()
    local t = getTileItemById(battlefield.tpPos, 1387)
    if t.uid > 0 then
        doRemoveItem(t.uid, 1)
        doSendMagicEffect(battlefield.tpPos, CONST_ME_POFF)
    end
end

function startBattlefield()
    if getGlobalStorageValue(battlefield.storage) ~= 0 then
        removeTp()
        if (battlefield.Max_Players - getGlobalStorageValue(battlefield.storage)) >= battlefield.Min_Players then
            doBroadcastMessage("[BATTLEFIELD] o evento vai começar em 1 minuto, crie sua estrategia.")
            addEvent(doBroadcastMessage, 60 * 1000, "[BATTLEFIELD] o evento começou.")
            addEvent(OpenWallBattle, 60 * 1000)
        else
            doBroadcastMessage("[BATTLEFIELD] o evento não começou por falta de players.")
            for _, cid in pairs(getPlayersOnline()) do
                if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then 
                    setPlayerStorageValue(cid, battlefield.storage2, -1)
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                end
            end
        end
    end
end

function OpenWallBattle()
    local x = true
    local B  = { 
        [1] = {1056,{x=2175, y=555, z=6, stackpos = 1}},   
        [2] = {1056,{x=2175, y=556, z=6, stackpos = 1}},
        [3] = {1056,{x=2175, y=557, z=6, stackpos = 1}},
        [4] = {1056,{x=2175, y=558, z=6, stackpos = 1}}   
        } 

    for i = 1, #B do
        if getTileItemById(B[2], B[1]).uid == 0 then 
            x = false 
        end
        if x == true then
            doRemoveItem(getThingfromPos(B[2]).uid,1)
        else
            doCreateItem(B[1], 1, B[2]) 
        end
    end
end

function getWinnersBattle(storage)
    local team = storage == 1 and battlefield.team1Name or battlefield.team2Name
    doBroadcastMessage("Jogadores do time ".. team .." ganharam o battlefield, eles receberão um Premio.")
    setGlobalStorageValue(battlefield.storage, -1)
    removeTp()
    OpenWallBattle()
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then 
            doRemoveCondition(cid, CONDITION_OUTFIT)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            if getPlayerStorageValue(cid, battlefield.storage2) == storage then
                doPlayerAddItem(cid,12715,15)
                doPlayerAddItem(cid,12701,1)
                doPlayerAddItem(cid,12734,3)
            end
            setPlayerStorageValue(cid, battlefield.storage2, -1)
        end
    end
end

 

 

Contato:

 

Link para o post
Compartilhar em outros sites
Em 01/07/2019 em 16:05, Dwarfer disse:
  Ocultar conteúdo


battlefield = {
    Time_To_Start_Event = 3, -- Tempo em minutos
    TeleportAID = 45000,
    Min_Players = 2,
    Max_Players = 40,
    storage = 201206300801,
    storage2 = 201206300802,
    tpPos = {x=283, y=225, z=8},
    pos_team_1 = {x=2159,y=557,z=7},
    pos_team_2 = {x=2192,y=556,z=7},
    spectors = {{x=2167,y=549,z=6},{x=2167,y=564,z=6},{x=2183,y=549,z=6},{x=2183,y=563,z=6}},
    team1Name = "Black Assassins",
    team2Name = "Red Barbarians",    
}

function doBroadCastBattle(type,msg)
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then
            doPlayerSendTextMessage(cid,type,msg) 
        end 
    end
    return true 
end

function removeTp()
    local t = getTileItemById(battlefield.tpPos, 1387)
    if t.uid > 0 then
        doRemoveItem(t.uid, 1)
        doSendMagicEffect(battlefield.tpPos, CONST_ME_POFF)
    end
end

function startBattlefield()
    if getGlobalStorageValue(battlefield.storage) ~= 0 then
        removeTp()
        if (battlefield.Max_Players - getGlobalStorageValue(battlefield.storage)) >= battlefield.Min_Players then
            doBroadcastMessage("[BATTLEFIELD] o evento vai começar em 1 minuto, crie sua estrategia.")
            addEvent(doBroadcastMessage, 60 * 1000, "[BATTLEFIELD] o evento começou.")
            addEvent(OpenWallBattle, 60 * 1000)
        else
            doBroadcastMessage("[BATTLEFIELD] o evento não começou por falta de players.")
            for _, cid in pairs(getPlayersOnline()) do
                if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then 
                    setPlayerStorageValue(cid, battlefield.storage2, -1)
                    doRemoveCondition(cid, CONDITION_OUTFIT)
                    doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                end
            end
        end
    end
end

function OpenWallBattle()
    local x = true
    local B  = { 
        [1] = {1056,{x=2175, y=555, z=6, stackpos = 1}},   
        [2] = {1056,{x=2175, y=556, z=6, stackpos = 1}},
        [3] = {1056,{x=2175, y=557, z=6, stackpos = 1}},
        [4] = {1056,{x=2175, y=558, z=6, stackpos = 1}}   
        } 

    for i = 1, #B do
        if getTileItemById(B[2], B[1]).uid == 0 then 
            x = false 
        end
        if x == true then
            doRemoveItem(getThingfromPos(B[2]).uid,1)
        else
            doCreateItem(B[1], 1, B[2]) 
        end
    end
end

function getWinnersBattle(storage)
    local team = storage == 1 and battlefield.team1Name or battlefield.team2Name
    doBroadcastMessage("Jogadores do time ".. team .." ganharam o battlefield, eles receberão um Premio.")
    setGlobalStorageValue(battlefield.storage, -1)
    removeTp()
    OpenWallBattle()
    for _, cid in pairs(getPlayersOnline()) do
        if getPlayerStorageValue(cid, battlefield.storage2) ~= -1 then 
            doRemoveCondition(cid, CONDITION_OUTFIT)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
            if getPlayerStorageValue(cid, battlefield.storage2) == storage then
                doPlayerAddItem(cid,12715,15)
                doPlayerAddItem(cid,12701,1)
                doPlayerAddItem(cid,12734,3)
            end
            setPlayerStorageValue(cid, battlefield.storage2, -1)
        end
    end
end

 

 

 

 

na hora que o evento inicia dar este erro na distro amigo. 

untitled.PNG

Editado por wesleyrush18 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Coloque as posições válidas onde são criadas as paredes nesta parte:

 local B  = { 
    [1] = {1056,{x=2175, y=555, z=6, stackpos = 1}},   
    [2] = {1056,{x=2175, y=556, z=6, stackpos = 1}},
    [3] = {1056,{x=2175, y=557, z=6, stackpos = 1}},
    [4] = {1056,{x=2175, y=558, z=6, stackpos = 1}}   
} 

 

Contato:

 

Link para o post
Compartilhar em outros sites
Em 03/07/2019 em 09:57, Dwarfer disse:

Coloque as posições válidas onde são criadas as paredes nesta parte:


 local B  = { 
    [1] = {1056,{x=2175, y=555, z=6, stackpos = 1}},   
    [2] = {1056,{x=2175, y=556, z=6, stackpos = 1}},
    [3] = {1056,{x=2175, y=557, z=6, stackpos = 1}},
    [4] = {1056,{x=2175, y=558, z=6, stackpos = 1}}   
} 

 

 

estas ai são as posição certo amigo.

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo