Ir para conteúdo
  • 0

[Resolvido] Erro getDamageMapPercent


Taiger

Pergunta

 Bom dia caros colegas. 


 Estou trabalhando em meu projeto PDA com sources e me deparei com este erro no sistema de task kill, aqueles npcs que pedem para matar uma certa quantidade de pokemons.

 

727315552_bugtask.png.6a16c9a37419fb1cb6a1645c6d76ac04.png

 

Este erro acontece quando o player mata os pokemons da task.

Código do script onde da o erro:

 

 


function onKill(cid, target)

local continue = true

if ehMonstro(target) then

    if isPlayerInDaily(cid) and not isDailyDone(cid) then
        if getDailyPokemon(cid) == getCreatureName(target) then
            doCountDaily(cid, getDailyPokemon(cid))
        end
    end

   for i = 91001, (91000+maxTasks) do
       local sto = getPlayerStorageValue(cid, i)
       if type(sto) == "string" then
          local array = getArrayFromStorage(cid, i)
          if arrayHasContent(array) then
             for e, f in pairs(array) do
                 for a = 1, #f do
                     if tostring(f[a][1]) == getCreatureNameWithProtect(target) and tonumber(f[a][2]) >= 1 then
                        if getDamageMapPercent(cid, target) < 0.5 then
                           continue = false
                        elseif (pokes[getPlayerStorageValue(cid, 854787)] and getCreatureNameWithProtect(getCreatureSummons(cid)[1]) ~= getPlayerStorageValue(cid, 854787)) then
                           if npcsTask[tostring(e).."_1"] then
                              continue = false             --task clan
                           end
                        elseif e == "Agatha" and getCreatureNameWithProtect(target) == "Shiny Abra" and not isInRange(getThingPos(target), Agatha.fromPos, Agatha.toPos) then
                           continue = false    --alterado v1.9 agatha quest
                        end
                        if continue then
                           f[a][2] = f[a][2]-1
                           if f[a][2] == 0 then
                              sendMsgToPlayer(cid, 20, tostring(e)..": Quest Done!")
                           else   
                              sendMsgToPlayer(cid, 20, tostring(e)..": You need to kill more "..f[a][2].." "..f[a][1]..(f[a][2] == 1 and "." or "s."))
                           end
                           setStorageArray(cid, i, array)
                        end
                        continue = true
                     end
                 end
             end
          end
       end
   end
end   

return true
end
 

 

Editado por Taiger
Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 1

É só tirar a parte do getDamageMapPercent, ficando assim:

function onKill(cid, target)

local continue = true

if ehMonstro(target) then

    if isPlayerInDaily(cid) and not isDailyDone(cid) then
        if getDailyPokemon(cid) == getCreatureName(target) then
            doCountDaily(cid, getDailyPokemon(cid))
        end
    end

   for i = 91001, (91000+maxTasks) do
       local sto = getPlayerStorageValue(cid, i)
       if type(sto) == "string" then
          local array = getArrayFromStorage(cid, i)
          if arrayHasContent(array) then
             for e, f in pairs(array) do
                 for a = 1, #f do
                     if tostring(f[a][1]) == getCreatureNameWithProtect(target) and tonumber(f[a][2]) >= 1 then
                        if (pokes[getPlayerStorageValue(cid, 854787)] and getCreatureNameWithProtect(getCreatureSummons(cid)[1]) ~= getPlayerStorageValue(cid, 854787)) then
                           if npcsTask[tostring(e).."_1"] then
                              continue = false             --task clan
                           end
                        elseif e == "Agatha" and getCreatureNameWithProtect(target) == "Shiny Abra" and not isInRange(getThingPos(target), Agatha.fromPos, Agatha.toPos) then
                           continue = false    --alterado v1.9 agatha quest
                        end
                        if continue then
                           f[a][2] = f[a][2]-1
                           if f[a][2] == 0 then
                              sendMsgToPlayer(cid, 20, tostring(e)..": Quest Done!")
                           else   
                              sendMsgToPlayer(cid, 20, tostring(e)..": You need to kill more "..f[a][2].." "..f[a][1]..(f[a][2] == 1 and "." or "s."))
                           end
                           setStorageArray(cid, i, array)
                        end
                        continue = true
                     end
                 end
             end
          end
       end
   end
end   

return true
end

 

Link para o comentário
Compartilhar em outros sites

  • 0
53 minutos atrás, Marshmello disse:

Seu servidor não tem essas função de  getDamageMapPercent

Pois é, pesquisei em tudo q é canto e não achei.

Link para o comentário
Compartilhar em outros sites

  • 0
10 horas atrás, SirDubstep disse:

É só tirar a parte do getDamageMapPercent, ficando assim:


function onKill(cid, target)

local continue = true

if ehMonstro(target) then

    if isPlayerInDaily(cid) and not isDailyDone(cid) then
        if getDailyPokemon(cid) == getCreatureName(target) then
            doCountDaily(cid, getDailyPokemon(cid))
        end
    end

   for i = 91001, (91000+maxTasks) do
       local sto = getPlayerStorageValue(cid, i)
       if type(sto) == "string" then
          local array = getArrayFromStorage(cid, i)
          if arrayHasContent(array) then
             for e, f in pairs(array) do
                 for a = 1, #f do
                     if tostring(f[a][1]) == getCreatureNameWithProtect(target) and tonumber(f[a][2]) >= 1 then
                        if (pokes[getPlayerStorageValue(cid, 854787)] and getCreatureNameWithProtect(getCreatureSummons(cid)[1]) ~= getPlayerStorageValue(cid, 854787)) then
                           if npcsTask[tostring(e).."_1"] then
                              continue = false             --task clan
                           end
                        elseif e == "Agatha" and getCreatureNameWithProtect(target) == "Shiny Abra" and not isInRange(getThingPos(target), Agatha.fromPos, Agatha.toPos) then
                           continue = false    --alterado v1.9 agatha quest
                        end
                        if continue then
                           f[a][2] = f[a][2]-1
                           if f[a][2] == 0 then
                              sendMsgToPlayer(cid, 20, tostring(e)..": Quest Done!")
                           else   
                              sendMsgToPlayer(cid, 20, tostring(e)..": You need to kill more "..f[a][2].." "..f[a][1]..(f[a][2] == 1 and "." or "s."))
                           end
                           setStorageArray(cid, i, array)
                        end
                        continue = true
                     end
                 end
             end
          end
       end
   end
end   

return true
end

 

Funcionou, obrigado mesmo.

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...