Postado Dezembro 2, 2017 7 anos Tipo do script: Npc Protocolo (versão do Tibia): 8.60 Servidor utilizado: Tfs 0.4 Nível de experiência: Médio Adicionais/Informações: Olá, Eu Tenho um npc que ele troca item por item, só que ele não da storage ai o pessoal leva 10 negocio e faz 10 vezes avontade Eu Gostaria que quando o player levasse 10 item por x item e ainda ganharia storage para não ir lá novamente falar com ele. Script : Spoiler 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 local items = { item1 = {5785, 13506} } local counts = { count1 = {10, 1} } 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, 'kefla') then if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then doPlayerRemoveItem(cid, items.item1[1], counts.count1[1]) doPlayerAddItem(cid, items.item1[2], counts.count1[2]) selfSay('You just swap '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..' for '.. counts.count1[2] ..' '.. getItemNameById(items.item1[2]) ..'.', cid) else selfSay('You need '.. counts.count1[1] ..' '.. getItemNameById(items.item1[1]) ..'.', cid) end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) URGENTEEE.. 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 Dezembro 2, 2017 7 anos Solução @Christinacsa, testa ai: local cfg = { need_item = {5785, 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]) 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('...', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ➥ Regras | Seções OTServ | Seções BOT
Postado Dezembro 2, 2017 7 anos Autor 26 minutos atrás, Wakon disse: @Christinacsa, testa ai: local cfg = { need_item = {5785, 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]) 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('...', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Só funciona com players Ou posso testar com Group 6? 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 Dezembro 2, 2017 7 anos 2 horas atrás, Christinacsa disse: Só funciona com players Ou posso testar com Group 6? 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 = { need_item = {5785, 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]) 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!)
Postado Dezembro 15, 2017 7 anos Autor Em 02/12/2017 em 10:45, Ckfox disse: 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 = { need_item = {5785, 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]) 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()) Olá tem como por pro player PAGAR + de 1 item ? Exemplo pago esses items 2160 - 10 / 5785 - 10 Por esse 13506 e ainda recebo a storage para não poder trocar mais. 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!.
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.