Ir para conteúdo

Featured Replies

Postado

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
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 player = Player(cid)
 
    if player:getLevel() < 30 then
        blessprize = 2000*6
    elseif player:getLevel() >= 30 and player:getLevel() <= 120 then
        blessprize = (((player:getLevel()-30)*200)+2000)*6
    elseif player:getLevel() > 120 then
        blessprize = 20000*6
    end
 
 
    if(msgcontains(msg, "blessing") or msgcontains(msg, "bless")) then
            npcHandler:say("Do you want to receive all blessings for "..blessprize.." gold?", cid)
            npcHandler.topic[cid] = 1
    end
    if(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            if player:hasBlessing(1) or player:hasBlessing(2) or player:hasBlessing(3) or player:hasBlessing(4) or player:hasBlessing(5) or player:hasBlessing(6) then
                npcHandler:say("You already have been blessed!", cid)
            else
                if player:removeMoney(blessprize) then
                    npcHandler:say("You have been blessed by all of six gods!, " .. player:getName() .. ".", cid)
                    player:addBlessing(1)
                    player:addBlessing(2)
                    player:addBlessing(3)
                    player:addBlessing(4)
                    player:addBlessing(5)
                    player:addBlessing(6)
                    player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
                    npcHandler.topic[cid] = 0
                else
                    npcHandler:say("Come back when you have enough money.", cid)
                    npcHandler.topic[cid] = 0
                end
            end
        end
    end
    if(msgcontains(msg, "no")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say("Then no.", cid)
            npcHandler.topic[cid] = 0
        end
    end
    if msgcontains(msg, "heal") then
        npcHandler:say("Do you need the healing now?", cid)
        npcHandler.topic[cid] = 2
    elseif(npcHandler.topic[cid] == 2) then
        if msgcontains(msg, "no") then
            npcHandler:say("As you wish.", cid)
            npcHandler.topic[cid] = 0
        elseif msgcontains(msg, "yes") then
            npcHandler:say("So be healed!", cid)
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
            doSendMagicEffect(getNpcPos(), CONST_ME_MAGIC_BLUE)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, fellow believer |PLAYERNAME|. I can offer you {blessings} or a free {heal}!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Always be on guard, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "This ungraceful haste is most suspicious!")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

ta dando esse erro.

 

[22/8/2018 10:51:5] [Error - NpcScript Interface] 
[22/8/2018 10:51:5] data/npc/scripts/alia.lua:onCreatureSay
[22/8/2018 10:51:5] Description: 
[22/8/2018 10:51:5] data/npc/scripts/alia.lua:14: attempt to call global 'Player' (a nil value)
[22/8/2018 10:51:5] stack traceback:
[22/8/2018 10:51:5]     data/npc/scripts/alia.lua:14: in function 'callback'
[22/8/2018 10:51:5]     data/npc/lib/npcsystem/npchandler.lua:456: in function 'onCreatureSay'
[22/8/2018 10:51:5]     data/npc/scripts/alia.lua:7: in function <data/npc/scripts/alia.lua:7>

 

 

 

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo