Ir para conteúdo

Featured Replies

  • Respostas 18
  • Visualizações 632
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Aqui... vá em npcs/scripts e crie um arquivo chamado Delivery Itens.lua e coloque isso dentro local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem

  • Se não se importa, fiz minha própria versão do código: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talk

  • Caso queria usar, já havia corrigido o debug e funciononou perfeitamente no 9.60

Postado

 

Aqui, testado e sem debugs...

era o tipo de mensagem kk

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
     
    if msgcontains(msg, 'reward') or msgcontains(msg, 'REWARD') and getPlayerStorageValue(cid, 22123) == 0 then
    if getPlayerVocation(cid) == 1 and getPlayerStorageValue(cid, 22123) == 0 then
    
            doPlayerAddItem(cid, 2160, 100) 
            setPlayerStorageValue(cid, 22123, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você pegou os itens de Sorcerer.")
     elseif getPlayerVocation(cid) == 2 and getPlayerStorageValue(cid, 22123) == 0 then 
            doPlayerAddItem(cid, 2160, 100)  
            setPlayerStorageValue(cid, 22123, 1) 
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você pegou os itens de Druid.")
    elseif getPlayerVocation(cid) == 3 and getPlayerStorageValue(cid, 22123) == 0 then  
            doPlayerAddItem(cid, 2160, 100) 
            setPlayerStorageValue(cid, 22123, 1)  
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você pegou os itens de Paladin.")
    elseif getPlayerVocation(cid) == 4 and getPlayerStorageValue(cid, 22123) == 0 then 
            doPlayerAddItem(cid, 2160, 100) 
            setPlayerStorageValue(cid, 22123, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você pegou os itens de Knight.")   
            return true
        end
    if msgcontains(msg, 'reward') or msgcontains(msg, 'REWARD') and getPlayerStorageValue(cid, 22123) == 1 then end
    npcHandler:say('Você já pegou os seus itens.', cid)
    end
    return true
end 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())  

Caso queria usar, já havia corrigido o debug e funciononou perfeitamente no 9.60

Te ajudei?
Se você achar que eu mereço, me dê uma "rep+" e selecione meu post como "melhor resposta"

 

Skype: JoadsonAion

Postado

Caso queria usar, já havia corrigido o debug e funciononou perfeitamente no 9.60

o meu é 8.60 e funcionou direitinho! Cada vocação recebendo seu devido item com sua devida mensagem

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Postado

Este erro é que a configuração não tem valor ^^

No meu a primeiro do @joadson Funcionou Direitinho

Dafuq?

 

@script

O erro está sendo causado pois você não possui a função getItemNameById(itemid).

Use este script:

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 config = {
        storage = 9671,
        items = {
            --[vocation_id] = {itemid, count},
            [1] = {2160, 100},                     --Exemplo.
        },
    }
    if msgcontains(msg:lower(), "reward") then
        if getPlayerStorageValue(cid, config.storage) > -1 then
            selfSay("You already got your reward.", cid)
            return true
        elseif not config.items[getPlayerVocation(cid)] then
            selfSay("No rewards for your vocation.", cid)
            return true
        end
        local item, count = config.items[getPlayerVocation(cid)][1], config.items[getPlayerVocation(cid)][2]
        setPlayerStorageValue(cid, config.storage, 1)
        doPlayerAddItem(cid, item, count)
        selfSay("You received {"..count.."x} "..getItemInfo(item).name..(count > 1 and "s" or "")..".", cid)
    end
    return true
end     
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

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.6k

Informação Importante

Confirmação de Termo