Ir para conteúdo

Featured Replies

Postado
2 horas atrás, onix disse:

Obrigado por ajudar amigo @Dukeeh mas deu esse erro:

 

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/quests/killing in the name of/kills.lua:onKill
...escripts/scripts/quests/killing in the name of/kills.lua:8: attempt to index field '?' (a nil value)
stack traceback:
    [C]: in function '__index'
    ...escripts/scripts/quests/killing in the name of/kills.lua:8: in function <...escripts/scripts/quests/killing in the name of/kills.lua:1>

 

Tfs 1. qual? Tenta assim:

function onKill(cid, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end
    local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks()
    for i = 1, #startedTasks do
        taskId = startedTasks
        if isInArray(tasks[taskId].creatures, targetName) then
            local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
            if killAmount < tasks[taskId].killsRequired then
                player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)
            end
        end
    end
    return true
end

asdukeeh.jpg

  • Respostas 8
  • Visualizações 711
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor
6 minutos atrás, DukeeH disse:

function onKill(cid, target) if target:isPlayer() or target:getMaster() then return true end local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks() for i = 1, #startedTasks do taskId = startedTasks if isInArray(tasks[taskId].creatures, targetName) then local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId) if killAmount < tasks[taskId].killsRequired then player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1) end end end return true end

Opa amigo! agora deu outro erro, TFS 1.2 aqui, muito obrigado por ajudar!

 

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/quests/killing in the name of/kills.lua:onKill
...escripts/scripts/quests/killing in the name of/kills.lua:5: attempt to index global 'player' (a nil value)
stack traceback:
    [C]: in function '__index'
    ...escripts/scripts/quests/killing in the name of/kills.lua:5: in function <...escripts/scripts/quests/killing in the name of/kills.lua:1>

 

Postado
2 minutos atrás, onix disse:

Opa amigo! agora deu outro erro, TFS 1.2 aqui, muito obrigado por ajudar!

 

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/quests/killing in the name of/kills.lua:onKill
...escripts/scripts/quests/killing in the name of/kills.lua:5: attempt to index global 'player' (a nil value)
stack traceback:
    [C]: in function '__index'
    ...escripts/scripts/quests/killing in the name of/kills.lua:5: in function <...escripts/scripts/quests/killing in the name of/kills.lua:1>

 

Não tenho muita expêriencia com 1.0+... 

Tenta assim... Tem certeza que se por lasthit ali na função ele funciona de boa e não da erro?

function onKill(creature, target)
    if target:isPlayer() or target:getMaster() then
        return true
    end

    local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks()
    for i = 1, #startedTasks do
        taskId = startedTasks
        if isInArray(tasks[taskId].creatures, targetName) then
            local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId)
            if killAmount < tasks[taskId].killsRequired then
                player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1)
            end
        end
    end

    return true
end

 

asdukeeh.jpg

Postado
  • Autor
55 minutos atrás, DukeeH disse:

function onKill(creature, target) if target:isPlayer() or target:getMaster() then return true end local targetName, startedTasks, taskId = target:getName():lower(), player:getStartedTasks() for i = 1, #startedTasks do taskId = startedTasks if isInArray(tasks[taskId].creatures, targetName) then local killAmount = player:getStorageValue(KILLSSTORAGE_BASE + taskId) if killAmount < tasks[taskId].killsRequired then player:setStorageValue(KILLSSTORAGE_BASE + taskId, killAmount + 1) end end end return true end

O novo erro
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/quests/killing in the name of/kills.lua:onKill
...escripts/scripts/quests/killing in the name of/kills.lua:6: attempt to index global 'player' (a nil value)
stack traceback:
    [C]: in function '__index'
    ...escripts/scripts/quests/killing in the name of/kills.lua:6: in function <...escripts/scripts/quests/killing in the name of/kills.lua:1>

 


Então o script original funciona perfeitamente mas só atribui o storage para 1 player, desanimando a fazer as tasks aqui no server, pois elas estão = no global, no meu servidor 8.60 e tfs 0.3 dava pra fazer as tasks em team e entao a galera ficou mal acostumada hehe

eu tenho um script q da storage a todos q ajudaram a matar, mas não consegui fazer ele usar as funções e as storages das tasks da killing in name of...

 

local bosses = {
    ['mawhawk'] = {status = 1, storage = 70008},
}

function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return true
    end

    local bossConfig = bosses[targetMonster:getName():lower()]
    if not bossConfig then
        return true
    end

    for pid, _ in pairs(targetMonster:getDamageMap()) do
        local attackerPlayer = Player(pid)
        if attackerPlayer then
            attackerPlayer:setStorageValue(70000, 1)
            attackerPlayer:setStorageValue(70008, 1)
        end
    end
end

 

 

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 520.1k

Informação Importante

Confirmação de Termo