Postado Dezembro 28, 2013 11 anos Quase @larafaz tem alguns outros aqui, rs Lubo local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local hasItems = {} local addonStatus = 12000 -- Storage key where addon status will be stored. local items = { -- [index (Don't even need this, but w/e)] = {id, count}, [1] = {5878, 100} } local wait = { storage = 12001, -- Storage key where time status will be stored. _time = 2 * 3600 -- Time to wait to get your addon. } local outfit = { types = {128, 136}, addon = 1 } 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, 'addon') and getCreatureStorage(cid, addonStatus) <= 0) then selfSay('Sorry, the backpack I wear is not for sale. It\'s handmade from rare minotaur leather.', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'minotaur leather') and talkState[talkUser] == 1 and getCreatureStorage(cid, addonStatus) <= 0) then selfSay('Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?', cid) talkState[talkUser] = 2 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2 and getCreatureStorage(cid, addonStatus) <= 0) then doCreatureSetStorage(cid, addonStatus, 1) selfSay('Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!', cid) talkState[talkUser] = nil elseif(msgcontains(msg, 'backpack') and getCreatureStorage(cid, addonStatus) == 1) then selfSay('Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then hasItems[talkUser] = true for _, data in ipairs(items) do if(getPlayerItemCount(cid, data[1]) < data[2]) then hasItems[talkUser] = false end end if(hasItems[talkUser]) then for _, data in ipairs(items) do doPlayerRemoveItem(cid, data[1], data[2]) end exhaustion.set(cid, wait.storage, wait._time) doCreatureSetStorage(cid, addonStatus, 2) selfSay('Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?', cid) else selfSay('You don\'t have required items.', cid) end hasItems[talkUser] = nil talkState[talkUser] = nil elseif(msgcontains(msg, 'addon') and getCreatureStorage(cid, addonStatus) == 2) then if(not exhaustion.get(cid, wait.storage)) then for _, _outfit in ipairs(outfit.types) do doPlayerAddOutfit(cid, _outfit, outfit.addon) end doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) doCreatureSetStorage(cid, addonStatus, 3) selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.', cid) else selfSay('Come back later, please.', cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Hanna local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local hasItems = {} local addonStatus = 12002 -- Storage key where addon status will be stored. local items = { -- [index (Don't even need this, but w/e)] = {id, count}, [1] = {5890, 100}, [2] = {5902, 50}, [3] = {2480, 1} } local wait = { storage = 12003, -- Storage key where time status will be stored. _time = 0 -- Time to wait to get your addon. } local outfit = { types = {128, 136}, addon = 2 } 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, 'addon') and getCreatureStorage(cid, addonStatus) <= 0) then selfSay('Pretty, isn\'t it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1 and getCreatureStorage(cid, addonStatus) <= 0) then selfSay('Okay, here we go, listen closely! I need a few things... a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers... and 50 honeycombs as glue. That\'s it, come back to me once you gathered it!', cid) talkState[talkUser] = nil doCreatureSetStorage(cid, addonStatus, 1) elseif(msgcontains(msg, 'hat') and getCreatureStorage(cid, addonStatus) == 1) then selfSay('Oh, you\'re back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?', cid) talkState[talkUser] = 3 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) and getPlayerItemCount(cid, 5890) >= 100 and getPlayerItemCount(cid, 5902) >= 50 and getPlayerItemCount(cid, 2480) >= 1 then doPlayerRemoveItem(cid, 5890, 100) doPlayerRemoveItem(cid, 5902, 50) doPlayerRemoveItem(cid, 2480, 1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) doCreatureSetStorage(cid, addonStatus, 3) selfSay('Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!', cid) if getPlayerSex(cid) == 1 then doPlayerAddOutfit(cid, 128, 2) elseif getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, 136, 2) Topic[talkUser] = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Elane local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 -- Storage IDs -- fhunter = 22003 shunter = 22004 newaddon = 'Ah, right! The hooded cloak or winged tiara! Here you go.' noitems = 'You do not have all the required items.' noitems2 = 'You do not have all the required items or you do not have the outfit, which by the way, is a requirement for this addon.' already = 'It seems you already have this addon, don\'t you try to mock me son!' function HunterFirst(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if isPlayer(cid) then addon = getPlayerStorageValue(cid,fhunter) if addon == -1 then if getPlayerItemCount(cid,5947) >= 1 and getPlayerItemCount(cid,5876) >= 100 and getPlayerItemCount(cid,5948) >= 100 and getPlayerItemCount(cid,5891) >= 5 and getPlayerItemCount(cid,5887) >= 1 and getPlayerItemCount(cid,5888) >= 1 and getPlayerItemCount(cid,5889) >= 1 then if doPlayerRemoveItem(cid,5947,1) and doPlayerRemoveItem(cid,5876,100) and doPlayerRemoveItem(cid,5948,100) and doPlayerRemoveItem(cid,5891,5) and doPlayerRemoveItem(cid,5887,1) and doPlayerRemoveItem(cid,5888,1) and doPlayerRemoveItem(cid,5889,1) then npcHandler:say('Ah, right! The hooded cloak or winged tiara! Here you go.') doSendMagicEffect(getCreaturePosition(cid), 13) setPlayerStorageValue(cid,fhunter,1) if getPlayerSex(cid) == 1 then doPlayerAddOutfit(cid, 129, 1) elseif getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, 137, 2) end end else selfSay(noitems) end else selfSay(already) end end end function HunterSecond(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if isPlayer(cid) then addon = getPlayerStorageValue(cid,shunter) if addon == -1 then if getPlayerItemCount(cid,5875) >= 1 then if doPlayerRemoveItem(cid,5875,1) then npcHandler:say('Ah, right! The sniper gloves! Here you go.') doSendMagicEffect(getCreaturePosition(cid), 13) setPlayerStorageValue(cid,shunter,1) if getPlayerSex(cid) == 1 then doPlayerAddOutfit(cid, 129, 2) elseif getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, 137, 1) end end else selfSay(noitems) end else selfSay(already) end end end node1 = keywordHandler:addKeyword({'hooded cloak'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get hooded cloak you need give me an engraved crossbow, 100 lizard leathers, 100 red dragon leather, 5 enchanted chicken wings, royal steel, hell steel and draconian steel. Do you have them with you?'}) node1:addChildKeyword({'yes'}, HunterFirst, {}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true}) node2 = keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get winged tiara you need give me an engraved crossbow, 100 lizard leathers, 100 red dragon leather, 5 enchanted chicken wings, royal steel, hell steel and draconian steel. Do you have them with you?'}) node2:addChildKeyword({'yes'}, HunterFirst, {}) node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true}) node3 = keywordHandler:addKeyword({'sniper gloves'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get sniper gloves you need give me a pair of sniper gloves. Do you have them with you?'}) node3:addChildKeyword({'yes'}, HunterSecond, {}) node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true}) node4 = keywordHandler:addKeyword({'second'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get sniper gloves you need give me a pair of sniper gloves. Do you have them with you?'}) node4:addChildKeyword({'yes'}, HunterSecond, {}) node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got all neccessary items.', reset = true}) npcHandler:addModule(FocusModule:new()) OBS: Ela pega os items mas não entrega o addon. me add no skype que eu arrumo todos pra voce
Postado Dezembro 29, 2013 11 anos tópico resolvido ? peça para alguém fecha-lo e move-lo para duvidas sanadas obrigado Cuidado com esse tipo de comentário, pode ser considerado flood. Dúvida sanada, tag adicionada. Tópico movido! 愛"A alma permanece em suas criações" 平(Não dou suporte por mensagem privada.)
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.