Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

OTX 2 servidor 7.4 com cliente 7.72

Qual o motivo deste tópico? 

Gostaria de colocar meu npc para vender bps de blank runes e manafluids em quantidades. (atualmente só vende de 1 em 1)

 

Você tem o código disponível? Se tiver publique-o aqui: 

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
-- OTServ event handling functions start
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
-- OTServ event handling functions end
 
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
 
    if msgcontains(msg, 'bp of lf') or msgcontains(msg, 'bp of life fluid') or msgcontains(msg, 'bp lf') then
        npcHandler:say('Do you want to buy a backpack of life fluid for 1200 gold coins?', cid)
        talk_state = 5
 
    elseif msgcontains(msg, 'yes') and talk_state == 5 then
        if getPlayerMoney(cid) >= 1200 then
            local red_bp = doPlayerAddItem(cid, 2000, 1)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doAddContainerItem(red_bp, 2006, 10)
            doPlayerRemoveMoney(cid, 1200)
            npcHandler:say('Thank you for buying.', cid)
            talk_state = 0
        else
            npcHandler:say('You don\'t have enough money.', cid)
            talk_state = 0
        end
    end
 
 
    if msgcontains(msg, 'bp of br') or msgcontains(msg, 'bp of blankrune') or msgcontains(msg, 'bp br') then
        npcHandler:say('Do you want to buy a backpack of blank runes for 200 gold coins?', cid)
        talk_state = 6
 
    elseif msgcontains(msg, 'yes') and talk_state == 6 then
        if getPlayerMoney(cid) >= 200 then
            local grey_bp = doPlayerAddItem(cid, 2003, 1)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doAddContainerItem(grey_bp, 2260)
            doPlayerRemoveMoney(cid, 200)
            npcHandler:say('Thank you for buying.', cid)
            talk_state = 0
        else
            npcHandler:say('You don\'t have enough money.', cid)
            talk_state = 0
        end
    end
 
 
    if msgcontains(msg, 'bp of mf') or msgcontains(msg, 'bp of manafluid') or msgcontains(msg, 'bp mf') then
        npcHandler:say('Do you want to buy a backpack of manafluid for 2000 gold coins?', cid)
        talk_state = 7
 
    elseif msgcontains(msg, 'yes') and talk_state == 7 then
        if getPlayerMoney(cid) >= 2000 then
            local purple_bp = doPlayerAddItem(cid, 2001, 1)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doAddContainerItem(purple_bp, 2006, 7)
            doPlayerRemoveMoney(cid, 2000)
            npcHandler:say('Thank you for buying.', cid)
            talk_state = 0
        else
            npcHandler:say('You don\'t have enough money.', cid)
            talk_state = 0
        end
    end
 
    return TRUE
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

SE ALGUEM PUDER AJUDAR, REP++++

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

Informação Importante

Confirmação de Termo