Ir para conteúdo
  • 0

Erro [NPC] 012-Table.lua


gabrielbuff

Pergunta

Boa noite, poderiam me ajudar nesse erro abaixo, quando eu falo hi, para algum npc aparece esse erro, impossibilitando a compra ou venda de itens nele

012-Table.lua -> script

 

table.find = function (table, value)
    for i, v in pairs(table) do
        if(v == value) then
            return i
        end
    end

    return nil
end

table.contains = function (txt, str)
    for i, v in pairs(str) do
        if(txt:find(v) and not txt:find('(%w+)' .. v) and not txt:find(v .. '(%w+)')) then
            return true
        end
    end

    return false
end
table.isStrIn = table.contains

table.count = function (table, item)
    local count = 0
    for i, n in pairs(table) do
        if(item == n) then
            count = count + 1
        end
    end

    return count
end
table.countElements = table.count

table.getCombinations = function (table, num)
    local a, number, select, newlist = {}, #table, num, {}
    for i = 1, select do
        a[#a + 1] = i
    end

    local newthing = {}
    while(true) do
        local newrow = {}
        for i = 1, select do
            newrow[#newrow + 1] = table[a]
        end

        newlist[#newlist + 1] = newrow
        i = select
        while(a == (number - select + i)) do
            i = i - 1
        end

        if(i < 1) then
            break
        end

        a = a + 1
        for j = i, select do
            a[j] = a + j - i
        end
    end

    return newlist
end

 

 

 

erro.png

Editado por gabrielbuff
esqueci de argumentar
Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 1

Tenta substituir:

elseif msgcontains(msg, {"não","no"}) then

Por

elseif msgcontains(msg, 'não') or msgcontains(msg, 'no'}) then

Se for isso provavelmente irá da erro nessa tambem

 

elseif msgcontains(msg, {"yes","sim"}) then
elseif msgcontains(msg, 'sim') or msgcontains(msg, 'yes') then

 

Link para o comentário
Compartilhar em outros sites

  • 0

@Poccnn, o que teria de errado no script coragem?

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid)    npcHandler:onCreatureAppear(cid)   end
function onCreatureDisappear(cid)   npcHandler:onCreatureDisappear(cid)   end
function onCreatureSay(cid, type, msg)   npcHandler:onCreatureSay(cid, type, msg)  end
function onThink()     npcHandler:onThink()     end

function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local msg = msg:lower()

local config = {
   effectonuse = 14, -- efeito que sai
   levelsorte = 10,  --- leveis que terão
   item = 10563,
   quant = 1+getPlayerStorageValue(cid,4002),
   storage = 4002 -- storage que será verificado
   }


if(msgcontains(msg, 'wisdom' )) then
npcHandler:say("Voce deseja evoluir seu nível de Wisdom?", cid)
elseif msgcontains(msg, {"não","no"}) then
selfSay('Ok!', cid)
talkState[talkUser] = 0
elseif msgcontains(msg, {"yes","sim"}) then
    if getPlayerStorageValue(cid, config.storage) < config.levelsorte then
        if getPlayerItemCount(cid, config.item) >= config.quant then
                        doPlayerRemoveItem(cid, config.item, config.quant)
                        doBroadcastMessage("[MENSAGEM]: O jogador (" .. getCreatureName(cid) .. ") recebeu um nivel de Wisdom da NPC Kelly.", 19)
                        doPlayerSendTextMessage(cid,22,"Voce evoluiu wisdom para "..(getPlayerStorageValue(cid, config.storage)+1)..".")
            setPlayerStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage)+1)
                        elseif getPlayerStorageValue(cid, config.storage) >= config.levelsorte then
            
        else
            selfSay('Você de '..config.quant..' {book of player}.', cid)
        end
    else
        selfSay('Você ja esta no level maxímo.' , cid)
      end
    end
   return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

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