Ir para conteúdo

Featured Replies

Postado
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
 
npcHandler:setMessage(MESSAGE_GREET, "Oi |PLAYERNAME|. Eu posso {trocar} item.")
 
function creatureSayCallback(cid, type, msg)
     if not npcHandler:isFocused(cid) then
         return false
     end

     local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

    if msgcontains(msg, "troca") then
        selfSay("Troco 50 brown piece of cloth e 200 gold por uma jacket, aceita?", cid)
        talkState[talkUser] = 1

    elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then        
        if getPlayerItemCount(cid, 5913) >= 50 and getPlayerMoney(cid) >= 200 then
            doPlayerRemoveItem(cid, 5913, 50) -- brown piece of cloth
            doPlayerRemoveMoney(cid, 200)
            doPlayerAddItem(cid, 2650) -- jacket
		else
			selfSay("Volte quando tiver os itens.", cid)
        end
    end
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

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

Informação Importante

Confirmação de Termo