Postado Março 25, 2015 10 anos Autor Testado em: TFS 0.4 Protocolo: 8.60 Crie um arquivo em data/npc com o nome Ajudante.xml e troque o que estiver dentro por isso: <?xml version="1.0" encoding="UTF-8"?> <npc name="Ajudante" script="Ajudante.lua" walkinterval="2000" speechbubble="1" floorchange="0"> <health now="100" max="100" /> <look type="160" head="98" body="95" legs="115" feet="114" addons="0"/> <parameters> <parameter key="message_greet" value="Ola, voce precisa de ajuda ? Eu dou items para os iniciantes! Quer os items ?" /> </parameters> </npc> Agora, em, data/npc/scripts crie um arquivo com nome Ajudante.lua e troque o que estiver dentro por isso: 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower() local items = { [1] = { {2160, 10}, {2159, 10}, }, [2] = { {2159, 10}, {2157, 10}, }, } local storage = 6554 if getPlayerStorageValue(cid, storage) >= 1 then npcHandler:say("Ja lhe entreguei os items, suma!", cid) return true elseif msgcontains(msg, "yes") then npcHandler:say("Aqui, tome seus items.", cid) for voc, item in pairs(items) do if items[getPlayerVocation(cid)] then for _, itemid in pairs(item) do doPlayerAddItem(cid,itemid[1],itemid[2]) end break end end setPlayerStorageValue(cid, storage, 1) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Configuração: Aqui: local items = { [1] = { {2160, 10}, {2159, 10}, }, [2] = { {2159, 10}, {2157, 10}, }, } Você põe os items de cada vocação, é o seguinte: [id da vocação] = { {id do item, quantidade}, } Repita o processo quantas vezes quiser, exemplo, se você quer que um player com a vocação de id 1 ganhe 3 items, você faz assim: local items = { [1] = { {2160, 2}, {2159, 10}, {2152, 20}, }, } Cara Chegou Perto Eu editei isto : 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower() local items = { [1] = { {2160, 10}, {2159, 10}, {9778, 2}, }, [2] = { {2159, 12}, {2160, 12}, }, [3] = { {2159, 11}, {2160, 11}, }, [4] = { {2159, 13}, {2160, 13}, }, } local storage = 655434 if getPlayerStorageValue(cid, storage) >= 1 then npcHandler:say("Ja lhe entreguei os items, suma!", cid) return true elseif msgcontains(msg, "yes") then npcHandler:say("Aqui, tome seus items.", cid) for voc, item in pairs(items) do if items[getPlayerVocation(cid)] then for _, itemid in pairs(item) do doPlayerAddItem(cid,itemid[1],itemid[2]) end break end end setPlayerStorageValue(cid, storage, 1) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Pouca coisa só editei a storage para ficar testando varias vezes no msm char e adicionei as 4 vocations! mas dai agora o npc esta dando apenas os items da vocation 4, eu sou vocation 1 e estou recebendo item da vocation 4! ajuda ai plx UpUpUp Alguem ajuda ai pf Pokémon Dust Evolution É aonde começa sua nova aventura!! Facebook Verifique Atualizações
Postado Março 25, 2015 10 anos 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end msg = msg:lower() local items = { [1] = { {2160, 10}, {2159, 10}, }, [2] = { {2159, 10}, {2157, 10}, }, } local storage = 6554 if getPlayerStorageValue(cid, storage) >= 1 then npcHandler:say("Ja lhe entreguei os items, suma!", cid) return true elseif msgcontains(msg, "yes") then npcHandler:say("Aqui, tome seus items.", cid) for voc, item in pairs(items) do if voc == getPlayerVocation(cid) then for _, itemid in pairs(item) do doPlayerAddItem(cid,itemid[1],itemid[2]) end break end end setPlayerStorageValue(cid, storage, 1) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Pequeno deslize meu, testa... _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Março 25, 2015 10 anos site acesse:http://rexwar.esy.es se te ajudei mi ajude com um like canal do youtube:https://www.youtube.com/channel/ blog:http://yakinhotutoriais.blogspot.com.br/ site acesse:http://rexwar.esy.es 0 comentários:
Postado Março 26, 2015 10 anos @Tibia2015br Peço que na próxima, poste algo de acordo com o pedido do tópico, porque o que tu postou não tem nada a haver com o proposto no tópico. Se o snows não se importar fiz o meu, baseado no dele hu3 : local items = { [1] = { {2160, 10}, {2159, 10}, {9778, 2}, }, [2] = { {2159, 12}, {2160, 12}, }, [3] = { {2159, 11}, {2160, 11}, }, [4] = { {2159, 13}, {2160, 13}, }, } local storage = 6554 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 function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end msg = msg:lower() if getPlayerStorageValue(cid, storage) >= 1 then npcHandler:say("Ja lhe entreguei os items, suma!", cid) return true end if msgcontains(msg, "yes") then for voc, item in pairs(items) do if voc == getPlayerVocation(cid) then for x = 1, #item do doPlayerAddItem(cid, item[x][1], item[x][2]) end break end end npcHandler:say("Aqui, tome seus items.", cid) setPlayerStorageValue(cid, storage, 1) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) xml usa o que o snows postou.
Postado Março 26, 2015 10 anos Autor Up Pokémon Dust Evolution É aonde começa sua nova aventura!! Facebook Verifique Atualizações
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.