Ir para conteúdo

Posts Recomendados

Data/Npcs/Crie Um Arquivo Xml Com O Nome Qe Qiser E Adicione

 

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Nome_Do_Npc" script="data/npc/scripts/Nome_Do_Arquivo.lua" walkinterval="2000" floorchange="0">

<health now="100" max="100"/>

<look type="335" head="114" body="114" legs="114" feet="114" addons="3"/>

<parameters>

<parameter key="message_greet" value="Greetings |PLAYERNAME|. I can sell you many nice addons! Just say 'addons'." />

</parameters>

</npc>

 

Data/Npcs/Script Crie Um Arquivo Lua Com O Nome Qe Qiser E Adicione

 

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, "Ola |PLAYERNAME|. Voce pode me ajudar? Se voce me ajudar, vou te recompensar com lindos addons! Basta dizer {addons} ou {help} se voce nao sabe o que fazer.")

 

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) == 0) and (parameters.premium == true) then

npcHandler:say('Desculpe, mas este addon e apenas para jogadores premium!', cid)

npcHandler:resetNpc()

return true

end

if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then

npcHandler:say('Voce ja tem esse 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('Trouxeste-me ' .. text .. ' por ' .. 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('Aqui esta.', cid)

else

npcHandler:say('Voce nao tem os items necessarios ou dinheiro!', cid)

end

npcHandler:resetNpc()

return true

elseif (parameters.decline == true) then

npcHandler:say('Este nao lhe interessa? Experimente outro!', 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 = false, cost = 0, items = {{5878,100}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10001})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second citizen addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5890,100}, {5902,50}, {2480,1}}, 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({'first hunter addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6512,1}, {5876,100}, {5948,100}, {5891,5}, {5887,1}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 10003})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second hunter addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5875,1}}, 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({'first knight addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5880,100}, {2400,1}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 10005})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second knight addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5893,100}}, 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({'first mage addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2182,1}, {2186,1}, {2193,20}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {5809,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {5904,10}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 10007})

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 = 10008})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

 

-- summoner (done)

local outfit_node = keywordHandler:addKeyword({'first summoner addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5878,200}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 10009})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second summoner addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5894,50}, {5911,50}, {5883,50}, {5879,50}, {5882,50}, {2392,20}, {5905,20}}, 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({'first barbarian addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2431,1}, {5911,10}, {5886,10}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second barbarian addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5880,100}, {5892,1}, {5893,50}, {5876,100}}, 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({'first druid addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5896,50}, {5897,50}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second druid addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5906,130}, {5897,100}}, 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({'first nobleman addon'}, playerBuyAddonNPC, {premium = false, cost = 1000000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second nobleman addon'}, playerBuyAddonNPC, {premium = false, cost = 1500000, items = {}, 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({'first oriental addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5945,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017})

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}, {5890,200}, {5912,100}}, 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({'first warrior addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5925,100}, {5899,100}, {5884,1}, {5919,1}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 10019})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second warrior addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5880,100}, {2400,1}}, 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({'first wizard addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022})

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 = 1, storageID = 10021})

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}, {5886,10}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5886,20}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023})

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 = 10024})

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 = 10025})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second beggar addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5883,30}, {2160,10}, {12540,200}}, 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({'first pirate addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6098,50}, {6126,50}, {6097,50}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 10027})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second pirate addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{6101,1}, {6102,1}, {6100,1}, {6099,1}}, 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({'first shaman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second shaman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{3966,5}, {3967,5}}, 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({'first norseman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7290,20}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7290,35}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

-- jester (done)(custom)

local outfit_node = keywordHandler:addKeyword({'first jester addon'}, playerBuyAddonNPC, {premium = false, cost = 100000, items = {{7957,1}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 10033})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second jester addon'}, playerBuyAddonNPC, {premium = false, cost = 100000, items = {{7958,1}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 10034})

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 = {{5906,100}, {5954,200}, {6500,500}, {2151,100}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 10035})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second demonhunter addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5906,250}, {6500,400}, {2151,200}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 10036})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

-- nightmare (done)(custom)

local outfit_node = keywordHandler:addKeyword({'first nightmare addon'}, playerBuyAddonNPC, {premium = false, cost = 1200000, items = {{6500,1000}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second nightmare addon'}, playerBuyAddonNPC, {premium = false, cost = 1300000, items = {{6500,1000}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

-- brotherhood (done)(custom)

local outfit_node = keywordHandler:addKeyword({'first brotherhood addon'}, playerBuyAddonNPC, {premium = false, cost = 1500000, items = {{6500,1000}}, outfit_female = 279, outfit_male = 278, addon = 1, storageID = 10039})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = false, cost = 2000000, items = {{6500,1000}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

-- yalaharian (done)(custom)

local outfit_node = keywordHandler:addKeyword({'first yalaharian addon'}, playerBuyAddonNPC, {premium = false, cost = 100000, items = {{8890,1}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 10041})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

-- Warmaster (done)(custom)

local outfit_node = keywordHandler:addKeyword({'first warmaster addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7390,1}, {2494,1}, {12735,200}}, outfit_female = 335, outfit_male = 336, addon = 1, storageID = 10043})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second warmaster addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{7434,1}, {5905,150}, {2421,1}}, outfit_female = 335, outfit_male = 336, addon = 2, storageID = 10044})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

 

-- Wayfarer (done)(custom)

local outfit_node = keywordHandler:addKeyword({'first wayfarer addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{5912,150}, {5910,150}, {5911,150}, {5913,150}, {5914,150}, {5909,150}}, outfit_female = 366, outfit_male = 367, addon = 1, storageID = 10045})

outfit_node:addChildKeywordNode(yesNode)

outfit_node:addChildKeywordNode(noNode)

local outfit_node = keywordHandler:addKeyword({'second wayfarer addon'}, playerBuyAddonNPC, {premium = false, cost = 0, items = {{8890,1}, {5910,20}, {5911,20}}, 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 te dar citizen, hunter, knight, mage, nobleman, summoner, warrior, barbarian, druid, wizard, oriental, pirate, assassin, beggar, shaman, norseman, nighmare, jester, yalaharian, brotherhood, demonhunter e Warmaster addons.'})

keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para comprar o primeiro addon fale \'first NAME addon\', Para o segundo addon fale \'second NAME addon\'.'})

 

npcHandler:addModule(FocusModule:new())

 

Ta Ai Mas Tem Npcs Aqi No Xtibia Era So Você Procurar.

Link para o comentário
https://xtibia.com/forum/topic/155367-npc-de-addom/#findComment-1026325
Compartilhar em outros sites

[19/04/2011 02:26:25] Lua Script Error: [Npc interface]

[19/04/2011 02:26:25] data/npc/scripts/addons.lua:onCreatureSay

[19/04/2011 02:26:25] data/npc/scripts/addons.lua:33: attempt to call global 'getItemNameById' (a nil value)

[19/04/2011 02:26:25] stack traceback:

[19/04/2011 02:26:25] [C]: in function 'getItemNameById'

[19/04/2011 02:26:25] data/npc/scripts/addons.lua:33: in function 'callback'

[19/04/2011 02:26:25] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'

[19/04/2011 02:26:25] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'

[19/04/2011 02:26:25] data/npc/lib/npcsystem/keywordhandler.lua:128: in function 'processMessage'

[19/04/2011 02:26:25] data/npc/lib/npcsystem/npchandler.lua:376: in function 'onCreatureSay'

[19/04/2011 02:26:25] data/npc/scripts/addons.lua:8: in function <data/npc/scripts/addons.lua:8>

 

 

mais um npc que não funciono.

se ajudar

Eu uzo The Forgotten Server - Version 0.2.10 (Mystic Spirit).

Link para o comentário
https://xtibia.com/forum/topic/155367-npc-de-addom/#findComment-1026328
Compartilhar em outros sites

Fiz um script não to entendendo o porque esta dando erro

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 buyAddons(cid, message, keywords, parameters, node)
--TODO: buyAddons function in modules.lua
if(not npcHandler:isFocused(cid)) then
	return false
end

local addon = parameters.addon
local cost = parameters.cost
local items = parameters.items
local premium = (parameters.premium ~= nil and parameters.premium)

if isPlayerPremiumCallback == nil or (isPlayerPremiumCallback(cid) and premium) then
	if doPlayerRemoveMoney(cid, cost) == TRUE then
		doPlayerAddAddons(cid, addon)
		npcHandler:say('Aqui esta.', cid)
	else
		npcHandler:say('Voce nao tem os items necessarios ou dinheiro!', cid)
	end
else
	npcHandler:say('Desculpe, mas este addon e apenas para jogadores premium!', cid)
end

keywordHandler:moveUp(1)
return true
end
-- citizen (done)
local node1 = keywordHandler:addKeyword({'first citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce vai precisar para o first citizen addons 100 minotaur leather ?'})
node1:addChildKeyword({'yes'}, buyAddons, {premium = false, cost = 0, items = {{5878,100}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10001})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

local node2 = keywordHandler:addKeyword({'second citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce vai precisar para o second addons 100 chicken feather ,50 honeycomb ,1 legion helmet?'})
node2:addChildKeyword({'yes'}, buyAddons, {premium = false, cost = 0, items = {{5890,100}, {5902,50}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10002})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})

keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Posso te dar citizen, hunter, knight, mage, nobleman, summoner, warrior, barbarian, druid, wizard, oriental, pirate, assassin, beggar, shaman, norseman, nighmare, jester, yalaharian, brotherhood, demonhunter e Warmaster addons.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Para comprar o primeiro addon fale \'first NAME addon\', Para o segundo addon fale \'second NAME addon\'.'})

npcHandler:addModule(FocusModule:new())

O NPC diz Desculpe, mas este addon e apenas para jogadores premium!

mesmo se eu tenha os itens e eu seje premium.

alguem ajuda ae!!

 

Consegui solucionar o problema vou fazer um topico encinando.

Editado por LukasScott
Link para o comentário
https://xtibia.com/forum/topic/155367-npc-de-addom/#findComment-1026726
Compartilhar em outros sites

×
×
  • Criar Novo...