Ir para conteúdo

Featured Replies

  • Respostas 15
  • Visualizações 881
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local config, buyPoke = {     diamondId = xxx,                    --ID do diamond.     pokemons = {         ["pokemon_name"] = price,       --["nome_do_pokémon"] = preço,         ["pokemon_name"] = pr

  • Ops. Código corrigido.

  • Falta de atenção minha. Código corrigido. Agora vai funcionar perfeitamente.

Postado
  • Autor

Obrigado jajá irei testar aki !


Cara está funcionando perfeitamente agora + tem um pequeno problema:

Quando o player compra um pokemon nele, não diminui os Small diamons do player !

e players sem Small Diamonds tambem conseguem comprar pokes !

+1 Rep+ pra vc !

 

Editado por J.L (veja o histórico de edições)

  •               6oI4lwi.gif
  • FusionPoké Estará aberto este mês para testes !
  • Curta A Page e Fique Por Dentro Das Novidades Do Servidor!   Like Aqui!
  •                         qNmeLvu.png
Postado
  • Autor

Está realmente perfeito agora !

+ 1 REP+ pra você !!!

  •               6oI4lwi.gif
  • FusionPoké Estará aberto este mês para testes !
  • Curta A Page e Fique Por Dentro Das Novidades Do Servidor!   Like Aqui!
  •                         qNmeLvu.png
  • 10 months later...
Postado
Em 02/05/2015 21:34:51, zipter98 disse:

local config, buyPoke = {
    diamondId = xxx,                    --ID do diamond.
    pokemons = {
        ["pokemon_name"] = price,       --["nome_do_pokémon"] = preço,
        ["pokemon_name"] = price,       --["nome_do_pokémon"] = preço,
        ["pokemon_name"] = price,       --["nome_do_pokémon"] = preço,
    },
}, ""
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
    if msgcontains(msg:lower(), "buy") or msgcontains(msg:lower(), "trade") then
        local str = ""
        for poke, price in pairs(config.pokemons) do
            if str == "" then
                str = poke.." - "..price.." diamonds"
            else
                str = str.."\n"..poke.." - "..price.." diamonds"
            end
        end
        selfSay("Hello, I sell this pokemons. Wanna buy any of them?", cid)
        doPlayerPopupFYI(cid, "Selling:\n"..str)
        talkState[talkUser] = 1
        return true
    elseif msgcontains(msg:lower(), "yes") then
        if talkState[talkUser] == 1 then
            selfSay("Tell me the name, please.", cid)
            talkState[talkUser] = 2
            return true
        elseif talkState[talkUser] == 3 then
            if buyPoke ~= "" then
                local price = config.pokemons[buyPoke]
                if doPlayerRemoveItem(cid, config.diamondId, price) then
                    selfSay("Here's your "..buyPoke.."!", cid)
                    addPokeToPlayer(cid, buyPoke, 0, 1, "normal", true)
                    talkState[talkUser] = 0
                    return true
                else
                    selfSay("You do not have "..price.." diamonds.", cid)
                    talkState[talkUser] = 0
                    return true
                end
            end
        end
    elseif config.pokemons[msg] and talkState[talkUser] == 2 then
        selfSay("You really wanna buy a "..msg.."? It will cost you "..config.pokemons[msg].." diamonds.", cid)
        buyPoke = msg
        talkState[talkUser] = 3
        return true
    elseif msgcontains(msg:lower(), "no") then
        selfSay("Then bye.", cid)
        talkState[talkUser] = 0
        return true
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

Cara...queria saber se tem como esse script pegar numa base cyan 8.54... essa parte eu adiciono no scritps da pasta data/npc/scripts certo?  mas o npc pra pasta data/npc  ... o que preciso fazer? '-' desculpa minha nubês mas, sei quase nads (ou nada .-. ) em scripts!!

 

obrigado desde já por responder! '-'

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