Ir para conteúdo

Featured Replies

Postado

Olá boa noite, venho aqui informar um erro que aparece no distro do servidor toda vez em que o player verifica suas Blessings pelos seguintes itens:
Ornamented Brooch id: 12385 e Ceremoniak Ankh id: 6561
O erro no distro é o seguinte, toda vez que o player da Use no item aparece corretamente 100% as informações se ele possui alguma bless, quais.. e até se não possui nenhuma, o erro é esse:
 
[19/01/2015 20:27:47] [Error - Action Interface]
[19/01/2015 20:27:47] data/actions/scripts/other/checkblessings.lua:onUse
[19/01/2015 20:27:47] Description:
[19/01/2015 20:27:47] (luaGetPlayerBlessing) Player not found

 
o sistema de bless que eu possuo é por charms
 
em Actions/scripts/other/checkblessings.lua está assim:

local BLESSINGS = {"Wisdom of Solitude", "Spark of the Phoenix", "Fire of the Suns", "Spiritual Shielding", "Embrace of Tibia", "Twist of Fate"}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local result = ""
    for i = 1, (table.maxn(BLESSINGS) - 1) do
        result = (getPlayerBlessing(cid, i) and result .. (result:len() > 0 and ", " or "") .. BLESSINGS or result)
    end

    if(getPlayerBlessing(cid) == table.maxn(BLESSINGS) - 1) then
        result = result .. ", " .. BLESSINGS[table.maxn(BLESSINGS)]
    end

    return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, result:len() > 0 and "Currently you have the following blessings: " .. result .. "." or "You do not have any blessing.")
end

e em actions/actions.xml está assim:

<action itemid="6561" script="other/checkblessings.lua"/>
<action itemid="12385" script="other/checkblessings.lua"/>

e tenho tbm a script de blessings, que é responsável pelas charms, acho que o erro não está nela, mas está aqui pra qualquer coisa..

actions/actions.xml

 

<action fromid="11252" toid="11256" script="other/blessings.lua"/> -- Blessings

actions/scripts/other/blessings.lua:

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(itemEx.itemid == 11256) then
        if(getPlayerBlessing(cid, 1)) then
            doPlayerSendCancel(cid, "You already have been blessed with the Wisdom of Solitude.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        else
            doPlayerAddBlessing(cid, 1)
            doRemoveItem(item.uid, 1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have recived the Wisdom of Solitude.")
        end
    elseif(itemEx.itemid == 11252) then
        if(getPlayerBlessing(cid, 2)) then
            doPlayerSendCancel(cid, "You already have been blessed with the Spark of the Phoenix.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        else
            doPlayerAddBlessing(cid, 2)
            doRemoveItem(item.uid, 1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have recived the Spark of the Phoenix.")
        end
    elseif(itemEx.itemid == 11255) then
        if(getPlayerBlessing(cid, 3)) then
            doPlayerSendCancel(cid, "You already have been blessed with the Fire of the Suns.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        else
            doPlayerAddBlessing(cid, 3)
            doRemoveItem(item.uid, 1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have recived the Fire of the Suns.")
        end
    elseif(itemEx.itemid == 11254) then
        if(getPlayerBlessing(cid, 4)) then
            doPlayerSendCancel(cid, "You already have been blessed with the Spiritual Shielding.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        else
            doPlayerAddBlessing(cid, 4)
            doRemoveItem(item.uid, 1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have recived the Spiritual Shielding.")
        end
    elseif(itemEx.itemid == 11253) then
        if(getPlayerBlessing(cid, 5)) then
            doPlayerSendCancel(cid, "You already have been blessed with the Embrace of Tibia.")
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
        else
            doPlayerAddBlessing(cid, 5)
            doRemoveItem(item.uid, 1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have recived the Embrace of Tibia..")
        end
        return true
    end
end

Alguém sabe porque esse erro no distro acontece toda vez em que o player verifica suas bless através dos 2 itens?

Agradeço qualquer ajuda!

Resolvido por ViitinG

Ir para solução
  • Respostas 8
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • "data/actions/scripts/tools/ceremonial_ankh" : local blessings = {"\nWisdom of Solitude", "\nSpark of the Phoenix", "\nFire of the Suns", "\nSpiritual Shielding", "\nEmbrace of Tibia"} function onUs

  • Qual versão do seu servidor e qual TFS você ta usando ?

  • Sim, se funcionou perfeitamente e os erros no distro desapareceram é só retirar o que você estava usando e deixar o que eu mandei.

Postado

Tenta mudar o checkbless.lua para este :

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local str = {"\nSpiritual Shielding", "\nEmbrace of Tibia", "\nFire of the Suns", "\nSpark of the Phoenix", "\nWisdom of Solitude", "\nTwist of Fate"}
	local result = "Received blessings:"
	local player = Player(cid)
	for i = 1, 6 do
		result = player:hasBlessing(i) and result .. str[i] or result
	end
	
	player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 20 > result:len() and "No blessings received." or result)
	return true
end

Postado
  • Autor

deu este erro e não diz mais quantos bless possui..

[19/01/2015 21:46:20] [Error - Action Interface]
[19/01/2015 21:46:20] data/actions/scripts/other/checkblessings.lua:onUse
[19/01/2015 21:46:20] Description:
[19/01/2015 21:46:20] data/actions/scripts/other/checkblessings.lua:4: attempt to call global 'Player' (a nil value)
[19/01/2015 21:46:20] stack traceback:
[19/01/2015 21:46:20]     data/actions/scripts/other/checkblessings.lua:4: in function <data/actions/scripts/other/checkblessings.lua:1>

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo