Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

@Christinacsa 

local cfg = {
    need_item = {5785, 10, 2160, 10},
    reward_item = {13506, 1},
    storage = 40531,
}

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
    local msg = msg:lower()

    if msgcontains(msg, 'kefla') then
        if getPlayerStorageValue(cid, cfg.storage) < 1 then
            if doPlayerRemoveItem(cid, cfg.need_item[1], cfg.need_item[2]) and doPlayerRemoveItem(cid, cfg.need_item[3], cfg.need_item[4])then
                doPlayerAddItem(cid, cfg.reward_item[1], cfg.reward_item[2])
                selfSay('You just swap '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..' for '.. cfg.reward_item[2] ..' '.. getItemNameById(cfg.reward_item[1]) ..'.', cid)
                setPlayerStorageValue(cid, cfg.storage, 1)
            else
                selfSay('You need '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..'.', cid)
            end
        else
            selfSay('You already did this exchange!', cid)
        end
    end
   return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

  • Respostas 9
  • Visualizações 794
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @Christinacsa, testa ai: local cfg = { need_item = {5785, 10}, reward_item = {13506, 1}, storage = 40531, } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:n

  • Makhai Drakon
    Makhai Drakon

    Pelo que eu li no script não tem nada constando o group, então funciona para ambos Aconselho só mudar o selfsay da linha 34 falando para o player que ele ja fez a troca. local cfg = { nee

  • Makhai Drakon
    Makhai Drakon

    @Christinacsa  local cfg = { need_item = {5785, 10, 2160, 10}, reward_item = {13506, 1, 2160, 1, 2161, 1, 2162, 1}, storage = 40531, } local keywordHandler = KeywordHandler:new() loca

Postado
  • Autor
15 minutos atrás, Ckfox disse:

@Christinacsa 


local cfg = {
    need_item = {5785, 10, 2160, 10},
    reward_item = {13506, 1},
    storage = 40531,
}

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
    local msg = msg:lower()

    if msgcontains(msg, 'kefla') then
        if getPlayerStorageValue(cid, cfg.storage) < 1 then
            if doPlayerRemoveItem(cid, cfg.need_item[1], cfg.need_item[2]) and doPlayerRemoveItem(cid, cfg.need_item[3], cfg.need_item[4])then
                doPlayerAddItem(cid, cfg.reward_item[1], cfg.reward_item[2])
                selfSay('You just swap '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..' for '.. cfg.reward_item[2] ..' '.. getItemNameById(cfg.reward_item[1]) ..'.', cid)
                setPlayerStorageValue(cid, cfg.storage, 1)
            else
                selfSay('You need '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..'.', cid)
            end
        else
            selfSay('You already did this exchange!', cid)
        end
    end
   return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Tem como eu adicionar mais items , aonde contem o nome kefla? gostaria de por um SET inteiro

Ai o player pagaria oque você acabou de adicionar saka?

Meu Servidor Minecraft : Ip - Skylowcraft.minecraftbr.net:25585 = Servidor 24hrs Sem Lag , Sem Hackers (1.7.2) Servidor De Fullpvp e Survival - Vamos Colocar Minigames!.

Postado

@Christinacsa Entendi não

 

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

Postado
  • Autor
10 horas atrás, Ckfox disse:

@Christinacsa Entendi não

 

Exemplo eu dou esses items que você acabou de adicionar 2 items com quantia de 10 totalizando 20 items 

Ai os jogadores iram pagar esses item e receberia 4 items  - 2180 , 2190 , 2191, 2192    e também receberia a storage

Meu Servidor Minecraft : Ip - Skylowcraft.minecraftbr.net:25585 = Servidor 24hrs Sem Lag , Sem Hackers (1.7.2) Servidor De Fullpvp e Survival - Vamos Colocar Minigames!.

Postado

@Christinacsa 

local cfg = {
    need_item = {5785, 10, 2160, 10},
    reward_item = {13506, 1, 2160, 1, 2161, 1, 2162, 1},
    storage = 40531,
}

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
    local msg = msg:lower()

    if msgcontains(msg, 'kefla') then
        if getPlayerStorageValue(cid, cfg.storage) < 1 then
            if doPlayerRemoveItem(cid, cfg.need_item[1], cfg.need_item[2]) and doPlayerRemoveItem(cid, cfg.need_item[3], cfg.need_item[4])then
                doPlayerAddItem(cid, cfg.reward_item[1], cfg.reward_item[2])
				doPlayerAddItem(cid, cfg.reward_item[3], cfg.reward_item[4])
				doPlayerAddItem(cid, cfg.reward_item[5], cfg.reward_item[6])
				doPlayerAddItem(cid, cfg.reward_item[7], cfg.reward_item[8])
                selfSay('You just swap '.. cfg.need_item[2] cfg.need_item[1] ..' and '.. cfg.need_item[4] cfg.need_item[3] ..'for a kefla set', cid)
                setPlayerStorageValue(cid, cfg.storage, 1)
            else
                selfSay('You need '.. cfg.need_item[2] ..' '.. getItemNameById(cfg.need_item[1]) ..'.', cid)
            end
        else
            selfSay('You already did this exchange!', cid)
        end
    end
   return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Ajudei? REP+

 

Meus Servers:

PokeUnwind Em Breve

Rust Tibia Fechado

 

Tópicos: 

[Tutorial] Adicionando Pokemons com icon system

[Solução] ElfBot não abre corpos

 

Projetos:

DigiTibia Fechado

Rust Tibia Fechado(temporariamente!)

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