Postado Setembro 14, 2014 10 anos bom galera, venho aq pedir a voces que me ajudem com esse script.. tipo assim, queria ele trocasse o item por algum outro .. exemplo : -- citizen (done) local outfit_node = keywordHandler:addKeyword({'first citizen addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5878,100}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 120001}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second citizen addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5890,100}, {5902,50}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 120002}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) ai o citiizin, queria q ele pedisse um um jester doll por exemplo .. e desse um addon ou os 2 logo de uma vez.. tambem queria que alguns dos addons fossem apenas para vips.. podem me ajudar?
Postado Setembro 14, 2014 10 anos ai o citiizin, queria q ele pedisse um um jester doll por exemplo .. e desse um addon ou os 2 logo de uma vez.. tambem queria que alguns dos addons fossem apenas para vips.. podem me ajudar? Poste o script completo desse NPC. Se te ajudei com o que postei, clique em Bizzle
Postado Setembro 14, 2014 10 anos Autor caso souberem, tbm pode ser um comando, tipo .. !addon 'mage' ... ou entao , os 2 .. tipo, comprando com o addoner por dinheiro e o outro por outro, pq o addoner nem funciona 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 npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|. Will you help me? If you do, I'll reward you with nice addons! Just say {addons} or {help} if you don't know what to do.") function playerBuyAddonNPC(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if (parameters.confirm ~= true) and (parameters.decline ~= true) then if(getPlayerPremiumDays(cid) == 1) and (parameters.premium == true) then npcHandler:say('Sorry, but this addon is only for vip players!', cid) npcHandler:resetNpc() return true end if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then npcHandler:say('You already have this addon!', cid) npcHandler:resetNpc() return true end local itemsTable = parameters.items local items_list = '' if table.maxn(itemsTable) > 0 then for i = 1, table.maxn(itemsTable) do local item = itemsTable items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1]) if i ~= table.maxn(itemsTable) then items_list = items_list .. ', ' end end end local text = '' if (parameters.cost > 0) and table.maxn(parameters.items) then text = items_list .. ' and ' .. parameters.cost .. ' gp' elseif (parameters.cost > 0) then text = parameters.cost .. ' gp' elseif table.maxn(parameters.items) then text = items_list end npcHandler:say('Did you bring me ' .. text .. ' for ' .. keywords[1] .. '?', cid) return true elseif (parameters.confirm == true) then local addonNode = node:getParent() local addoninfo = addonNode:getParameters() local items_number = 0 if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items if (getPlayerItemCount(cid,item[1]) >= item[2]) then items_number = items_number + 1 end end end if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then doPlayerRemoveMoney(cid, addoninfo.cost) if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items doPlayerRemoveItem(cid,item[1],item[2]) end end doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon) doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon) setPlayerStorageValue(cid,addoninfo.storageID,1) npcHandler:say('Here you are.', cid) else npcHandler:say('You do not have needed items or cash!', cid) end npcHandler:resetNpc() return true elseif (parameters.decline == true) then npcHandler:say('Not interested? Maybe other addon?', cid) npcHandler:resetNpc() return true end return false end local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true}) local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true}) -- citizen (done) local outfit_node = keywordHandler:addKeyword({'first citizen addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{9693,1}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 120001}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second citizen addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{9693,1}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 120002}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- hunter (done) local outfit_node = keywordHandler:addKeyword({'first hunter addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5947,1}, {5876,100}, {5948,100}, {5891,5}, {5887,1}, {5889,1}, {5888,1}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 12003}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second hunter addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5875,1}}, outfit_female = 137, outfit_male = 129, addon = 2, storageID = 12004}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- knight (done) local outfit_node = keywordHandler:addKeyword({'first knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5892,1}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 12005}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5893,100}, {5924,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 12006}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- mage (done) local outfit_node = keywordHandler:addKeyword({'first mage addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {2392,30}, {5809,1}, {2193,20}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 12007}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second mage addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5903,1}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 12008}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- summoner (done) local outfit_node = keywordHandler:addKeyword({'first summoner addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5958,1}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 12009}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second summoner addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5894,70}, {5911,20}, {5883,40}, {5922,35}, {5886,10}, {5881,60}, {5882,40}, {2392,3}, {5905,30}}, outfit_female = 141, outfit_male = 133, addon = 2, storageID = 120010}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- barbarian (done) local outfit_node = keywordHandler:addKeyword({'first barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5884,1}, {5885,1}, {5910,50}, {5911,50}, {5886,10}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 120011}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5892,1}, {5893,50}, {5876,50}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 120012}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- druid (done) local outfit_node = keywordHandler:addKeyword({'first druid addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5896,50}, {5897,50}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 120013}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second druid addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5906,100}, {2030,1}, {5940,1}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 120014}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- nobleman (done) local outfit_node = keywordHandler:addKeyword({'first nobleman addon'}, playerBuyAddonNPC, {premium = false, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 120115}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second nobleman addon'}, playerBuyAddonNPC, {premium = false, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 120116}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- oriental (done) local outfit_node = keywordHandler:addKeyword({'first oriental addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{11423,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 120017}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second oriental addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5883,100}, {5895,100}, {5891,2}, {5912,100}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 120018}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- warrior (done) local outfit_node = keywordHandler:addKeyword({'first warrior addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5925,100}, {5899,100}, {5884,1}, {5919,1}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 120019}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second warrior addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5887,1}}, outfit_female = 142, outfit_male = 134, addon = 2, storageID = 120020}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- wizard (done) local outfit_node = keywordHandler:addKeyword({'first wizard addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 120021}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second wizard addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5922,50}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 120022}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- assassin (done) local outfit_node = keywordHandler:addKeyword({'first assassin addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5886,10}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 120023}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second assassin addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 120024}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- beggar (done) local outfit_node = keywordHandler:addKeyword({'first beggar addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5878,50}, {5921,30}, {5913,20}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 120025}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second beggar addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5883,100}, {2160,2}, {6107,1}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 120026}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- pirate (done) local outfit_node = keywordHandler:addKeyword({'first pirate addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6098,100}, {6126,100}, {6097,100}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 120027}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second pirate addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6101,1}, {6102,1}, {6100,1}, {6099,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 120028}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- shaman (done) local outfit_node = keywordHandler:addKeyword({'first shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 120029}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 120030}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- norseman (done) local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 120031}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 120032}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- jester (done)(custom) local outfit_node = keywordHandler:addKeyword({'first jester addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5878,4}, {5879,1}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 120033}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second jester addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5909,5}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 120034}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- demonhunter (done)(custom) local outfit_node = keywordHandler:addKeyword({'first demonhunter addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6500,20}, {5905,20}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 120035}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second demonhunter addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5906,50}, {6500,200}, {2151,100}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 120036}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- nightmare (done)(custom) local outfit_node = keywordHandler:addKeyword({'first nightmare addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6500,500}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 120037}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second nightmare addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6500,500}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 120038}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- brotherhood (done)(custom) local outfit_node = keywordHandler:addKeyword({'first brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,500}}, outfit_female = 279, outfit_male = 278, addon = 1, storageID = 120039}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,500}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 120040}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- yalaharian (done)(custom) local outfit_node = keywordHandler:addKeyword({'first yalaharian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 120041}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second yalaharian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 2, storageID = 120042}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- wayfarer (done)(custom) local outfit_node = keywordHandler:addKeyword({'first wayfarer addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11302,4}}, outfit_female = 329, outfit_male = 328, addon = 1, storageID = 120045}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second wayfarer addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11302,8}}, outfit_female = 329, outfit_male = 328, addon = 2, storageID = 120046}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- warmaster (done)(custom) local outfit_node = keywordHandler:addKeyword({'first warmaster addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11116,1}}, outfit_female = 336, outfit_male = 335, addon = 1, storageID = 120044}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) local outfit_node = keywordHandler:addKeyword({'second warmaster addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11115,1}}, outfit_female = 336, outfit_male = 335, addon = 2, storageID = 120043}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you citizen, hunter, knight, mage, nobleman, summoner, warrior, barbarian, druid, wizard, oriental, pirate, assassin, beggar, shaman, norseman, nighmare, jester, yalaharian, brotherhood, warmaster and wayfarer addons.'}) keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.'}) npcHandler:addModule(FocusModule:new())
Postado Setembro 14, 2014 10 anos Você quer que ele venda os addons em troca de um jeste doll ? Ou quer criar o addon doll ? não entendi direito ;-; Editado Setembro 14, 2014 10 anos por folfer (veja o histórico de edições)
Postado Setembro 14, 2014 10 anos Arquivo .lua do NPC: 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 npcHandler:setMessage(MESSAGE_GREET, "Hello |PLAYERNAME|. Can you help me? If you help me, I will reward you with beautiful addons! Say {addons} or {help} if you do not know what to do.") function playerBuyAddonNPC(cid, message, keywords, parameters, node) local player = Player(cid) if(not npcHandler:isFocused(cid)) then return false end if (parameters.confirm ~= true) and (parameters.decline ~= true) then if(player:getPremiumDays(cid) == 0) and (parameters.premium == true) then npcHandler:say('Sorry, but this addon and only for premium players!', cid) npcHandler:resetNpc() elseif (player:getStorageValue(parameters.storageVIP) <= 0) then npcHandler:say('Sorry, but this addon and only for VIP players!', cid) npcHandler:resetNpc() return true end if (player:getStorageValue(parameters.storageID) >= 1) then npcHandler:say('You already have this addon!', cid) npcHandler:resetNpc() return true end if (player:getStorageValue(parameters.storageVIP) >= 2) then npcHandler:say('You already have this VIP addon!', cid) npcHandler:resetNpc() return true end local itemsTable = parameters.items local items_list = '' if table.maxn(itemsTable) > 0 then for i = 1, table.maxn(itemsTable) do local item = itemsTable[i] items_list = items_list .. item[2] .. ' ' .. getItemName(item[1]) if i ~= table.maxn(itemsTable) then items_list = items_list .. ', ' end end end local text = '' if (parameters.cost > 0) and table.maxn(parameters.items) then text = items_list .. ' and ' .. parameters.cost .. ' gp' elseif (parameters.cost > 0) then text = parameters.cost .. ' gp' elseif table.maxn(parameters.items) then text = items_list end npcHandler:say('Brought me ' .. text .. ' by ' .. keywords[1] .. '?', cid) return true elseif (parameters.confirm == true) then local addonNode = node:getParent() local addoninfo = addonNode:getParameters() local items_number = 0 if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items[i] if (player:getItemCount(item[1]) >= item[2]) then items_number = items_number + 1 end end end if(player:getMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then player:removeMoney(addoninfo.cost) if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items[i] player:removeItem(item[1],item[2]) end end player:addOutfitAddon(addoninfo.outfit_male, addoninfo.addon) player:addOutfitAddon(addoninfo.outfit_female, addoninfo.addon) player:setStorageValue(addoninfo.storageID,1) npcHandler:say('Here it is.', cid) else npcHandler:say('You do not have the necessary items or money!', cid) end if(player:getMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) and (player:getStorageValue(parameters.storageVIP) >= 1) then player:removeMoney(addoninfo.cost) if table.maxn(addoninfo.items) > 0 then for i = 1, table.maxn(addoninfo.items) do local item = addoninfo.items[i] player:removeItem(item[1],item[2]) end end if table.maxn(addoninfo.giveitems) > 0 then for i = 1, table.maxn(addoninfo.giveitems) do local giveitem = addoninfo.giveitems[i] player:addItem(giveitem[1], giveitem[2]) end end player:setStorageValue(addoninfo.storageVIP,1) npcHandler:say('Here it is.', cid) else npcHandler:say('You do not have the necessary items or money!', cid) end npcHandler:resetNpc() return true elseif (parameters.decline == true) then npcHandler:say('This does not interest you? Try another!', cid) npcHandler:resetNpc() return true end return false end local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true}) local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true}) -- citizen local outfit_node = keywordHandler:addKeyword({'citizen addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5878,100}, {5890,100}, {5902,50}, {2480,1}}, giveitems = {9693, 1}, storageVIP = 54321}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- hunter local outfit_node = keywordHandler:addKeyword({'hunter addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5876,100}, {5948,100}, {5891,5}, {5887,1}, {5889,1}, {5888,1}, {5875,1}}, outfit_female = 137, outfit_male = 129, addon = 3, storageID = 10071}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- mage local outfit_node = keywordHandler:addKeyword({'mage addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {2392,30}, {5903,1}}, outfit_female = 138, outfit_male = 130, addon = 3, storageID = 10023) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- knight local outfit_node = keywordHandler:addKeyword({'knight addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5880,100}, {5892,1}, {5893,100}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 3, storageID = 10073}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- summoner local outfit_node = keywordHandler:addKeyword({'summoner addon'}, playerBuyAddonNPC, {premium = false, items = {{5958,1}, {5894,70}, {5911,20}, {5883,40}, {5922,35}, {5886,10}, {5881,60}, {5882,40}, {5904,15}, {5905,30}}, cost = 0, outfit_female = 141, outfit_male = 133, addon = 3, storageID = 10075}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- barbarian local outfit_node = keywordHandler:addKeyword({'barbarian addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5884,1}, {5911,10}, {5886,10}, {5880,100}, {5892,1}, {5893,50}, {5876,5}}, outfit_female = 147, outfit_male = 143, addon = 3, storageID = 10025}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- druid local outfit_node = keywordHandler:addKeyword({'druid addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5896,50}, {5897,50}, {5906,100}, {5940,1}}, outfit_female = 148, outfit_male = 144, addon = 3, storageID = 10027}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- nobleman local outfit_node = keywordHandler:addKeyword({'nobleman addon'}, playerBuyAddonNPC, {premium = false, cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 3, storageID = 10029}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- oriental local outfit_node = keywordHandler:addKeyword({'oriental addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5945,1}, {5883,100}, {5895,100}, {5891,1}, {5912,100}}, outfit_female = 150, outfit_male = 146, addon = 3, storageID = 10031}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- pirate local outfit_node = keywordHandler:addKeyword({'pirate addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6098,100}, {6126,100}, {6097,100}, {6101,1}, {6102,1}, {6100,1}, {6099,1}}, outfit_female = 155, outfit_male = 151, addon = 3, storageID = 10031}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- warrior local outfit_node = keywordHandler:addKeyword({'warrior addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5925,15}, {5899,50}, {5884,1}, {5919,1}, {5880,100}, {5887,1}}, outfit_female = 142, outfit_male = 134, addon = 3, storageID = 10033}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- wizard local outfit_node = keywordHandler:addKeyword({'wizard addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}, {5922,50}}, outfit_female = 149, outfit_male = 145, addon = 3, storageID = 10035}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- assassin local outfit_node = keywordHandler:addKeyword({'assassin addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 3, storageID = 10037}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- shaman local outfit_node = keywordHandler:addKeyword({'shaman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5810,1}, {3955,1}, {5015,1}, {3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 3, storageID = 10039}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- jester local outfit_node = keywordHandler:addKeyword({'jester addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7957,1}, {7958,1}}, outfit_female = 270, outfit_male = 273, addon = 3, storageID = 10041}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- nightmare local outfit_node = keywordHandler:addKeyword({'nightmare addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6500,1500}, {6500,1500}}, outfit_female = 269, outfit_male = 268, addon = 3, storageID = 10043}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- yalaharian local outfit_node = keywordHandler:addKeyword({'yalaharian addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{9955,1}, {10309,1}}, outfit_female = 324, outfit_male = 325, addon = 3, storageID = 10045}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- warmaster local outfit_node = keywordHandler:addKeyword({'warmaster addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{11328,1}, {11231,1}}, outfit_female = 335, outfit_male = 336, addon = 3, storageID = 10047}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- wayfarer local outfit_node = keywordHandler:addKeyword({'wayfarer addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{12657,1}, {12656,1}}, outfit_female = 366, outfit_male = 367, addon = 3, storageID = 10049}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- beggar local outfit_node = keywordHandler:addKeyword({'beggar addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5878,50}, {5921,30}, {5913,20}, {5894,10}, {5883,100}}, outfit_female = 157, outfit_male = 153, addon = 3, storageID = 10071}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- brotherhood local outfit_node = keywordHandler:addKeyword({'brotherhood addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6500,1500}, {6500,1500}}, outfit_female = 279, outfit_male = 278, addon = 3, storageID = 10073}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- norseman local outfit_node = keywordHandler:addKeyword({'norseman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7290,5}, {7290,10}}, outfit_female = 252, outfit_male = 251, addon = 3, storageID = 10075}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) -- demonhunter local outfit_node = keywordHandler:addKeyword({'norseman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7290,5}, {7290,10}}, outfit_female = 252, outfit_male = 251, addon = 3, storageID = 10075}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you: citizen, hunter, mage, knight, nobleman, summoner, warrior, barbarian, druid, wizard, oriental, pirate, assassin, beggar, shaman, norseman, nighmare, jester, brotherhood, yalaharian, warmaster and wayfarer addons.'}) keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'For help with addons talk {help addon}.'}) keywordHandler:addKeyword({'help addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To buy the full addon talk \'NAME addon\'. Ex: \'nobleman addon\'.'}) npcHandler:addModule(FocusModule:new()) No script acima eu usei como exemplo do seu pedido, os addons do outfit citizen. Como pode notar: -- citizen local outfit_node = keywordHandler:addKeyword({'citizen addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5878,100}, {5890,100}, {5902,50}, {2480,1}}, giveitems = {9693, 1}, storageVIP = 12345}) outfit_node:addChildKeywordNode(yesNode) outfit_node:addChildKeywordNode(noNode) em troca dos itens/quantidade: items = {5878,100}, {5890,100}, {5902,50}, {2480,1} o player receberá o item/quantidade (1 jester doll): giveitem = {9693, 1} porém, ele só receberá o jester doll, se ele tiver o valor da storage VIP: storageVIP = 12345 Basta modificar os valores de acordo com o seu servidor, ou como quiser. Na pasta data/talkactions/scripts crie um arquivo nomeado por jesterdoll.lua e adicione o script: local text = {"Command param required.", "You already have this addon!", "You received the addon!", "You need a addon doll!"} local outfits = { ["citizen"] = {136, 128}, ["hunter"] = {137, 129}, ["mage"] = {138, 130}, ["knight"] = {139, 131}, ["noblewoman"] = {140, 132}, ["summoner"] = {141, 133}, ["warrior"] = {142, 134}, ["barbarian"] = {147, 143}, ["druid"] = {148, 144}, ["wizard"] = {149, 145}, ["oriental"] = {150, 146}, ["pirate"] = {155, 151}, ["assassin"] = {156, 152}, ["beggar"] = {157, 153}, ["shaman"] = {158, 154}, ["norsewoman"] = {252, 251}, ["nightmare"] = {269, 268}, ["jester"] = {270, 273}, ["brotherhood"] = {279, 278}, ["demonhunter"] = {288, 289}, ["yalaharian"] = {324, 325}, ["warmaster"] = {336, 335}, ["wayfarer"] = {366, 367} } function onSay(cid, words, param) local player, param = Player(cid), string.lower(param) local jesterdoll_id = 9693 if player:getItemCount(jesterdoll_id) > 0 then if param ~= "" and outfits[param] then if (not player:hasOutfit(outfits[param][1], 3)) or (not player:hasOutfit(outfits[param][2], 3)) then Position(getThingPos(cid)):sendMagicEffect(CONST_ME_GIFT_WRAPS) player:removeItem(jesterdoll_id, 1) player:addOutfitAddon(outfits[param][1], 3) player:addOutfitAddon(outfits[param][2], 3) player:sendTextMessage(MESSAGE_INFO_DESCR, text[3]) else player:sendCancelMessage(text[2]) end else player:sendCancelMessage(text[1]) end else player:sendCancelMessage(text[4]) end return true end Agora em talkactions.xml (data/talkactions), adicione a seguinte tag: <talkaction words="!addon" script="jesterdoll.lua"/> Para editar o ID do jester doll, basta modificar no script acima, onde está: local jesterdoll_id = 9693pelo ID do item que você desejar (mas lembre-se de que esse item deve conter o mesmo ID do item que o player irá receber pelo NPC). Créditos da TalkAction: luanluciano93Creditos do NPC: eu mesmoPS: não testei Editado Setembro 14, 2014 10 anos por Bizzle (veja o histórico de edições) Se te ajudei com o que postei, clique em Bizzle
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.