Ir para conteúdo
  • 0

NPC de addons


Zaruss

Pergunta

Alguêm tem algum script de npc de addon para a versao 10.10 que eu possa usar mais que n compre um addon por vez e sim por partes por que todos que eu achei você compra 1 addon de uma outfit

Simplesmente um npc que quando você fala first ele te vende todos ou first addon por 500k de todos os outfits e second tbm 1kk

 

Obrigado desde já.

Editado por Zaruss
Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

esse vende o first addon;

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mr Jhon" script="data/npc/scripts/addons1.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="149" head="94" body="77" legs="96" feet="3" addons="3"/>
</npc>
vai em npc e scripts e coloca 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
npcHandler:setMessage(MESSAGE_GREET, "Olá |PLAYERNAME|. Eu vendo todos os primeiros addons, por 50k cada. É só me falar o nome do addon que você quer. Exemplo: knight.")
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('Desculpe, mas este addon é somente para jogadores premium!', cid)
npcHandler:resetNpc()
return true
end
if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
npcHandler:say('Você já tem este 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('Você trouxe-me ' .. text .. ' para ' .. 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('Muito obrigado, aqui está seu addon.', cid)
else
npcHandler:say('Você não tem dinheiro suficiente para este addon!', cid)
end
npcHandler:resetNpc()
return true
elseif (parameters.decline == true) then
npcHandler:say('Não está interessado neste? Talvez o outro 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({'citizen'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10001})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- hunter (done)
local outfit_node = keywordHandler:addKeyword({'hunter'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 10003})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- knight (done)
local outfit_node = keywordHandler:addKeyword({'knight'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 10005})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- mage (done)
local outfit_node = keywordHandler:addKeyword({'mage'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 10007})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- summoner (done)
local outfit_node = keywordHandler:addKeyword({'summoner'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 10009})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- barbarian (done)
local outfit_node = keywordHandler:addKeyword({'barbarian'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- druid (done)
local outfit_node = keywordHandler:addKeyword({'druid'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- nobleman (done)
local outfit_node = keywordHandler:addKeyword({'nobleman'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- oriental (done)
local outfit_node = keywordHandler:addKeyword({'oriental'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- warrior (done)
local outfit_node = keywordHandler:addKeyword({'warrior'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 10019})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- wizard (done)
local outfit_node = keywordHandler:addKeyword({'wizard'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- assassin (done)
local outfit_node = keywordHandler:addKeyword({'assassin'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- beggar (done)
local outfit_node = keywordHandler:addKeyword({'beggar'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- pirate (done)
local outfit_node = keywordHandler:addKeyword({'pirate'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 10027})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- shaman (done)
local outfit_node = keywordHandler:addKeyword({'shaman'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- norseman (done)
local outfit_node = keywordHandler:addKeyword({'norseman'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- jester (done)
local outfit_node = keywordHandler:addKeyword({'jester'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 10033})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- demonhunter (done)
local outfit_node = keywordHandler:addKeyword({'demon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 10035})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- nightmare (done)
local outfit_node = keywordHandler:addKeyword({'nightmare'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- brotherhood (done)
local outfit_node = keywordHandler:addKeyword({'brotherhood'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 136, outfit_male = 278, addon = 1, storageID = 10039})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- yalaharian (done)
local outfit_node = keywordHandler:addKeyword({'yalaharian'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 10041})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- warmaster (done)
local outfit_node = keywordHandler:addKeyword({'warmaster'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 336, outfit_male = 337, addon = 1, storageID = 10043})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- wayfarer (done)
local outfit_node = keywordHandler:addKeyword({'wayfarer'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2160,5}}, outfit_female = 366, outfit_male = 366, addon = 1, storageID = 10045})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Posso dar-lhe citizen, hunter, knight, mage, nobleman, summoner, warrior, barbarian, druid, wizard, oriental, pirate, assassin, beggar, shaman, norseman, nighmare, jester, brotherhood, yalaharian, warmaster e wayfarer addons.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para comprar o primeiro addon fale {NAME addon}, para o segundo fale {second NAME addon}.'})
npcHandler:addModule(FocusModule:new())

 

 

 

 

AGORA O SECOND ADDON

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mr Klayer" script="data/npc/scripts/addons2.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="0" body="114" legs="114" feet="120" addons="3"/>
</npc>
VAI EM NPC SCRIPTS E ADD 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
npcHandler:setMessage(MESSAGE_GREET, "Olá |PLAYERNAME|. Eu vendo todos os segundos addons, por 150k cada. É só me falar o nome do addon que você quer. Exemplo: knight.")
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('Desculpe, mas este addon é somente para jogadores premium!', cid)
npcHandler:resetNpc()
return true
end
if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
npcHandler:say('Você já tem este 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('Você trouxe-me ' .. text .. ' para ' .. 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('Muito obrigado, aqui está seu addon.', cid)
else
npcHandler:say('Você não tem dinheiro suficiente para este addon!', cid)
end
npcHandler:resetNpc()
return true
elseif (parameters.decline == true) then
npcHandler:say('Não está interessado neste? Talvez o outro 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({'citizen'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10002})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- hunter (done)
local outfit_node = keywordHandler:addKeyword({'hunter'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 137, outfit_male = 129, addon = 2, storageID = 10004})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- knight (done)
local outfit_node = keywordHandler:addKeyword({'knight'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10006})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- mage (done)
local outfit_node = keywordHandler:addKeyword({'mage'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 10008})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- summoner (done)
local outfit_node = keywordHandler:addKeyword({'summoner'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 141, outfit_male = 133, addon = 2, storageID = 10010})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- barbarian (done)
local outfit_node = keywordHandler:addKeyword({'barbarian'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- druid (done)
local outfit_node = keywordHandler:addKeyword({'druid'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- nobleman (done)
local outfit_node = keywordHandler:addKeyword({'nobleman'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- oriental (done)
local outfit_node = keywordHandler:addKeyword({'oriental'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- warrior (done)
local outfit_node = keywordHandler:addKeyword({'warrior'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 142, outfit_male = 134, addon = 2, storageID = 10020})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- wizard (done)
local outfit_node = keywordHandler:addKeyword({'wizard'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- assassin (done)
local outfit_node = keywordHandler:addKeyword({'assassin'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- beggar (done)
local outfit_node = keywordHandler:addKeyword({'beggar'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- pirate (done)
local outfit_node = keywordHandler:addKeyword({'pirate'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- shaman (done)
local outfit_node = keywordHandler:addKeyword({'shaman'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- norseman (done)
local outfit_node = keywordHandler:addKeyword({'norseman'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- jester (done)
local outfit_node = keywordHandler:addKeyword({'jester'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 10034})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- demonhunter (done)
local outfit_node = keywordHandler:addKeyword({'demon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 10036})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- nightmare (done)
local outfit_node = keywordHandler:addKeyword({'nightmare'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- brotherhood (done)
local outfit_node = keywordHandler:addKeyword({'brotherhood'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 136, outfit_male = 278, addon = 2, storageID = 10040})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- yalaharian (done)
local outfit_node = keywordHandler:addKeyword({'yalaharian'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 324, outfit_male = 325, addon = 2, storageID = 10042})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- warmaster (done)
local outfit_node = keywordHandler:addKeyword({'warmaster'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 336, outfit_male = 337, addon = 2, storageID = 10044})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
-- wayfarer (done)
local outfit_node = keywordHandler:addKeyword({'wayfarer'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2160,15}}, outfit_female = 366, outfit_male = 367, addon = 2, storageID = 10046})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Posso dar-lhe citizen, hunter, knight, mage, nobleman, summoner, warrior, barbarian, druid, wizard, oriental, pirate, assassin, beggar, shaman, norseman, nighmare, jester, brotherhood, yalaharian, warmaster e wayfarer addons.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para comprar o primeiro addon fale {first NAME addon}, para o segundo fale {second NAME addon}.'})
npcHandler:addModule(FocusModule:new())
Link para o comentário
Compartilhar em outros sites

  • 0

Nao e esse que quero e que o player falasse first addons e o npc vende-se todos os primeiros addon e depois o player falasse second addons e o npc desse os second addons dos outfits pra ele

Link para o comentário
Compartilhar em outros sites

  • 0

Nao e esse que quero e que o player falasse first addons e o npc vende-se todos os primeiros addon e depois o player falasse second addons e o npc desse os second addons dos outfits pra ele

entaum esse o player chega e fala hi first addons e recebe todos os primeiros addons que estao na lista ae do script se quiser por mais so addicionar quando fala second recebe todos tbm se quiser tirar ou por mais so modificar o script

Link para o comentário
Compartilhar em outros sites

  • 0

Tente desta forma:

 

 

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

    if(msgcontains(msg, 'first addons') or msgcontains(msg, 'first')) then
        selfSay('Greetings man, I would just buy the first addons by 500k ({yes} or {no})?', cid)
        talkState[talkUser] = 1
    elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
        
        if getPlayerMoney(cid) < 500000 then
            selfSay('Unfortunately you do not have the money, so get back.', cid)
            talkState[talkUser] = 0
            return true
        end
    
        for i = 110, 399 do
            doPlayerAddOutfit(cid, {lookType = i}, 1)
        end
    
        doPlayerRemoveMoney(cid, 500000)
        doSendMagicEffect(getThingPos(cid), 14)
        selfSay('Thank you for your preference, here are your first addons.', cid)
        talkState[talkUser] = 0
        return true
    end
            
    return true
 end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

#GoodLuck.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...