• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

HELP Addons NPC 8.6

breispodeu

Mapper/Scripter/C++ Programmer
Joined
Jul 25, 2009
Messages
80
Reaction score
5
GitHub
lucasoares
My script:

Code:
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}, {outfits} 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
		local thingstr = 'addon'
		if parameters.addon == 0 then
			thingstr = 'outfit'
		end
        if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
            npcHandler:say('Sorry, but this ' .. thingstr .. ' is only for premium players!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
            npcHandler:say('You already have this ' .. thingstr .. '!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (parameters.stID_outfit ~= 0) and (getPlayerStorageValue(cid, parameters.stID_outfit) == -1) then
            npcHandler:say('You must have this outfit first before buying addons!', 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] .. ' ' .. 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[i]
                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[i]
                    doPlayerRemoveItem(cid,item[1],item[2])
                end
            end
			
			if getPlayerSex(cid) == PLAYERSEX_MALE then
				doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
			elseif getPlayerSex(cid) == PLAYERSEX_FEMALE then
				-- female addons fixes
				if addoninfo.outfit_female == 137 or addoninfo.outfit_female == 157 then
					if addoninfo.addon == 1 then
						addoninfo.addon = 2
					elseif addoninfo.addon == 2 then
						addoninfo.addon = 1
					end
				end
				-- end female addon fixes
				doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
			else
				npcHandler:say('Sorry, your sex is wrong.', cid)
				return true
			end
            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)
-- addon1 storage = 10001
-- addon2 storage = 10002
-- outfit storage = 0
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 = 10001, stID_outfit = 0})
    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 = 10002, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- hunter (done)
-- addon1 storage = 10003
-- addon2 storage = 10004
-- outfit storage = 0
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 = 10003, stID_outfit = 0})
    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 = 10004, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- knight (done)
-- addon1 storage = 10005
-- addon2 storage = 10006
-- outfit storage = 0
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 = 10005, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5893,100}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10006, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- mage (done)
-- addon1 storage = 10007
-- addon2 storage = 10008
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {2189,1}, {2187,1}, {5904,10}, {5809,1}, {2193,20}}, outfit_female = 141, outfit_male = 130, addon = 1, storageID = 10007, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5903,1}}, outfit_female = 141, outfit_male = 130, addon = 2, storageID = 10008, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 

-- summoner (done)
-- addon1 storage = 10009
-- addon2 storage = 10010
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5958,1}}, outfit_female = 138, outfit_male = 133, addon = 1, storageID = 10009, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5894,70}, {5911,20}, {5883,40}, {5922,35}, {5879,100}, {5881,60}, {5882,40}, {5904,15}, {5905,30}}, outfit_female = 138, outfit_male = 133, addon = 2, storageID = 10010, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 


-- barbarian (done)
-- addon1 storage = 10011
-- addon2 storage = 10012
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5892,1}, {5893,50}, {5876,50}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5884,1}, {5885,1}, {5910,50}, {5911,50}, {5879,100}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- druid (done)
-- addon1 storage = 10013
-- addon2 storage = 10014
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5896,50}, {5897,50}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5906,100}, {5939,1}, {5940,1}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- nobleman (done)
-- addon1 storage = 10015
-- addon2 storage = 10016
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- oriental (done)
-- addon1 storage = 10017
-- addon2 storage = 10018
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11423,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5883,100}, {5895,100}, {5891,2}, {5912,100}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- warrior (done)
-- addon1 storage = 10019
-- addon2 storage = 10020
-- outfit storage = 0
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 = 10019, stID_outfit = 0})
    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 = 10020, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- wizard (done)
-- addon1 storage = 10021
-- addon2 storage = 10022
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5922,50}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- assassin (done)
-- addon1 storage = 10023
-- addon2 storage = 10024
-- outfit storage = 10051
local outfit_node = keywordHandler:addKeyword({'first assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5879,100}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5804,1}, {5930,1}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'assassin outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5898,30}, {5882,10}, {5881,30}, {5885,1}, {5906,10}, {5905,20}, {5895,20}}, outfit_female = 156, outfit_male = 152, addon = 0, storageID = 10051, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- beggar (done)
-- addon1 storage = 10025
-- addon2 storage = 10026
-- outfit storage = 10052
local outfit_node = keywordHandler:addKeyword({'first beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 20000, items = {{5883,100}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6107,1}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'beggar outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5878,50}, {5921,30}, {5913,20}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 0, storageID = 10052, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- pirate (done) -
-- addon1 storage = 10027
-- addon2 storage = 10028
-- outfit storage = 10053
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 = 10027, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second pirate addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11426,1}, {6102,1}, {11425,1}, {11424,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'pirate outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6096,1}, {6095,1}, {5918,1}, {5462,1}}, outfit_female = 155, outfit_male = 151, addon = 0, storageID = 10053, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- shaman (done) - 
-- addon1 storage = 10029
-- addon2 storage = 10030
-- outfit storage = 10054
local outfit_node = keywordHandler:addKeyword({'first shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029, stID_outfit = 10054})
   outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030, stID_outfit = 10054})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- norseman (done) -- 
-- addon1 storage = 10031
-- addon2 storage = 10032
-- outfit storage = 10055
local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- jester (undone)
-- addon1 storage = 10033
-- addon2 storage = 10034
-- outfit storage = 10056

-- demonhunter (undone)
-- addon1 storage = 10035
-- addon2 storage = 10036
-- outfit storage = 10057

-- nightmare (done)
-- addon1 storage = 10037
-- addon2 storage = 10038
-- outfit storage = 10058
local outfit_node = keywordHandler:addKeyword({'first nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,500}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- brotherhood (done)
-- addon1 storage = 10039
-- addon2 storage = 10040
-- outfit storage = 10059
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 = 10039, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
	
-- yalaharian (undone)
-- addon1 storage = 10041
-- addon2 storage = 10041
-- outfit storage = 10060

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. Other addons can be obtained in quests.'})
keywordHandler:addKeyword({'outfits'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you assassin, beggar and pirate outfits. I can\'t give you the norseman, the yalaharian, the wayfarer, the jester, the nightmare and the brotherhood outfits for now.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'. For an outfit say \'NAME outfit\'.'})

npcHandler:addModule(FocusModule:new())

GOOGLE TRADUTOR

Sorry, I don't have time right now to try to use what I know of English

On my server, some outfits are achieved through others ways. The problem is that when I ask, for example, the first addon of some these outfits without having the outfit, he will say: "Varkhal: You must have this outfit first before buying addons!". Buy if I say yes after this, the npc will check the items normally, as if I had the addon and if I have the items in my backpack, he will give me the addon AND the outfit. Exemple of a conversating (I had no pirate outfit but I had the items for the second pirate addon):

16:47 GOD [1]: hi
16:47 Varkhal: Greetings GOD. Will you help me? If you do, I'll reward you with nice addons! Just say addons, outfits or help if you don't know what to do.
16:47 GOD [1]: second pirate addon
16:47 Varkhal: You must have this outfit first before buying addons!
16:48 GOD [1]: yes
16:48 Varkhal: Here you are.

Some1 can help me?

How I can make this work: "npcHandler:resetNpc()"?
 
Try this one:

PHP:
local canBuyAddon = false
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}, {outfits} 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
		local thingstr = 'addon'
		if parameters.addon == 0 then
			thingstr = 'outfit'
		end
        if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
            npcHandler:say('Sorry, but this ' .. thingstr .. ' is only for premium players!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
            npcHandler:say('You already have this ' .. thingstr .. '!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (parameters.stID_outfit ~= 0) and (getPlayerStorageValue(cid, parameters.stID_outfit) == -1) then
            npcHandler:say('You must have this outfit first before buying addons!', 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] .. ' ' .. 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)
		canBuyAddon = true		
        return true
    elseif (parameters.confirm == true and canBuyAddon == true) then		
        local addonNode = node:getParent()
        local addoninfo = addonNode:getParameters()
        local items_number = 0
		canBuyAddon = false
        if table.maxn(addoninfo.items) > 0 then
            for i = 1, table.maxn(addoninfo.items) do
                local item = addoninfo.items[i]
                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[i]
                    doPlayerRemoveItem(cid,item[1],item[2])
                end
            end
			
			if getPlayerSex(cid) == PLAYERSEX_MALE then
				doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
			elseif getPlayerSex(cid) == PLAYERSEX_FEMALE then
				-- female addons fixes
				if addoninfo.outfit_female == 137 or addoninfo.outfit_female == 157 then
					if addoninfo.addon == 1 then
						addoninfo.addon = 2
					elseif addoninfo.addon == 2 then
						addoninfo.addon = 1
					end
				end
				-- end female addon fixes
				doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
			else
				npcHandler:say('Sorry, your sex is wrong.', cid)
				return true
			end
            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)
		canBuyAddon = false
        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)
-- addon1 storage = 10001
-- addon2 storage = 10002
-- outfit storage = 0
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 = 10001, stID_outfit = 0})
    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 = 10002, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- hunter (done)
-- addon1 storage = 10003
-- addon2 storage = 10004
-- outfit storage = 0
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 = 10003, stID_outfit = 0})
    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 = 10004, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- knight (done)
-- addon1 storage = 10005
-- addon2 storage = 10006
-- outfit storage = 0
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 = 10005, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5893,100}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10006, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- mage (done)
-- addon1 storage = 10007
-- addon2 storage = 10008
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {2189,1}, {2187,1}, {5904,10}, {5809,1}, {2193,20}}, outfit_female = 141, outfit_male = 130, addon = 1, storageID = 10007, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5903,1}}, outfit_female = 141, outfit_male = 130, addon = 2, storageID = 10008, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 

-- summoner (done)
-- addon1 storage = 10009
-- addon2 storage = 10010
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5958,1}}, outfit_female = 138, outfit_male = 133, addon = 1, storageID = 10009, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5894,70}, {5911,20}, {5883,40}, {5922,35}, {5879,100}, {5881,60}, {5882,40}, {5904,15}, {5905,30}}, outfit_female = 138, outfit_male = 133, addon = 2, storageID = 10010, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 


-- barbarian (done)
-- addon1 storage = 10011
-- addon2 storage = 10012
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5892,1}, {5893,50}, {5876,50}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5884,1}, {5885,1}, {5910,50}, {5911,50}, {5879,100}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- druid (done)
-- addon1 storage = 10013
-- addon2 storage = 10014
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5896,50}, {5897,50}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5906,100}, {5939,1}, {5940,1}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- nobleman (done)
-- addon1 storage = 10015
-- addon2 storage = 10016
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- oriental (done)
-- addon1 storage = 10017
-- addon2 storage = 10018
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11423,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5883,100}, {5895,100}, {5891,2}, {5912,100}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- warrior (done)
-- addon1 storage = 10019
-- addon2 storage = 10020
-- outfit storage = 0
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 = 10019, stID_outfit = 0})
    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 = 10020, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- wizard (done)
-- addon1 storage = 10021
-- addon2 storage = 10022
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5922,50}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- assassin (done)
-- addon1 storage = 10023
-- addon2 storage = 10024
-- outfit storage = 10051
local outfit_node = keywordHandler:addKeyword({'first assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5879,100}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5804,1}, {5930,1}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'assassin outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5898,30}, {5882,10}, {5881,30}, {5885,1}, {5906,10}, {5905,20}, {5895,20}}, outfit_female = 156, outfit_male = 152, addon = 0, storageID = 10051, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- beggar (done)
-- addon1 storage = 10025
-- addon2 storage = 10026
-- outfit storage = 10052
local outfit_node = keywordHandler:addKeyword({'first beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 20000, items = {{5883,100}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6107,1}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'beggar outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5878,50}, {5921,30}, {5913,20}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 0, storageID = 10052, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- pirate (done) -
-- addon1 storage = 10027
-- addon2 storage = 10028
-- outfit storage = 10053
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 = 10027, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second pirate addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11426,1}, {6102,1}, {11425,1}, {11424,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'pirate outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6096,1}, {6095,1}, {5918,1}, {5462,1}}, outfit_female = 155, outfit_male = 151, addon = 0, storageID = 10053, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- shaman (done) - 
-- addon1 storage = 10029
-- addon2 storage = 10030
-- outfit storage = 10054
local outfit_node = keywordHandler:addKeyword({'first shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029, stID_outfit = 10054})
   outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030, stID_outfit = 10054})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- norseman (done) -- 
-- addon1 storage = 10031
-- addon2 storage = 10032
-- outfit storage = 10055
local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- jester (undone)
-- addon1 storage = 10033
-- addon2 storage = 10034
-- outfit storage = 10056

-- demonhunter (undone)
-- addon1 storage = 10035
-- addon2 storage = 10036
-- outfit storage = 10057

-- nightmare (done)
-- addon1 storage = 10037
-- addon2 storage = 10038
-- outfit storage = 10058
local outfit_node = keywordHandler:addKeyword({'first nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,500}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- brotherhood (done)
-- addon1 storage = 10039
-- addon2 storage = 10040
-- outfit storage = 10059
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 = 10039, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
	
-- yalaharian (undone)
-- addon1 storage = 10041
-- addon2 storage = 10041
-- outfit storage = 10060

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. Other addons can be obtained in quests.'})
keywordHandler:addKeyword({'outfits'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you assassin, beggar and pirate outfits. I can\'t give you the norseman, the yalaharian, the wayfarer, the jester, the nightmare and the brotherhood outfits for now.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'. For an outfit say \'NAME outfit\'.'})

npcHandler:addModule(FocusModule:new())

I added a variable to control correctly this. Look for canBuyAddon in the script and you will find where i addedd this.

Regards,
 
Doesn't have a way to fix the reset function? All NPC's need that..

- - - Updated - - -

The script doesn't work.. He continues giving the addon without outfit and If I say "yes" and "yes" and "yes", he will take every time the items for addon, if I have then of course.. Ex.:

19:23 Teste [1]: hi
19:23 Varkhal2: Greetings Teste. Will you help me? If you do, I'll reward you with nice addons! Just say addons, outfits or help if you don't know what to do.
19:23 Teste [1]: first nobleman addon
19:23 Varkhal2: Did you bring me 150000 gp for first nobleman addon?
19:23 Teste [1]: yes
19:23 Varkhal2: Here you are.
19:23 Teste [1]: yes
19:23 Varkhal2: Here you are.
19:23 Teste [1]: first nobleman addon
19:23 Varkhal2: Not interested? Maybe other addon?
19:23 Teste [1]: yes
19:23 Varkhal2: Here you are.
19:23 Teste [1]: bye
19:23 Varkhal2: Good bye, Teste!
19:23 Teste [1]: hi
19:23 Varkhal2: Greetings Teste. Will you help me? If you do, I'll reward you with nice addons! Just say addons, outfits or help if you don't know what to do.
19:23 Teste [1]: first nobleman addon
19:23 Varkhal2: You already have this addon!
19:23 Teste [1]: yes
19:23 Varkhal2: Here you are.
19:23 Teste [1]: yes
19:23 Varkhal2: Here you are.
 
Last edited:
Doesn't have a way to fix the reset function? All NPC's need that..

- - - Updated - - -

The script doesn't work.. He continues giving the addon without outfit and If I say "yes" and "yes" and "yes", he will take every time the items for addon, if I have then of course.. Ex.:

This function normally is inside data/npc/lib/npcsystem/npchandler.lua

PHP:
        -- Resets the npc into it's initial state (in regard of the keyrodhandler).
        --      All modules are also receiving a reset call through their callbackOnModuleReset function.
        function NpcHandler:resetNpc()
                if(self:processModuleCallback(CALLBACK_MODULE_RESET)) then
                        self.keywordHandler:reset()
                end
        end

and data/npc/lib/npcsystem/keywordhandler.lua

PHP:
       -- Resets the lastNode field, and this resetting the current position in the node hierarchy to root.
        function KeywordHandler:reset()
                self.lastNode = nil
        end

It seems that the function is correct and the addon script is the problem.

I noticed that in my server the script is the same of your so has the same problem. I did a fix that i will test tonight. If you want to test before feel free:

PHP:
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}, {outfits} 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
        local thingstr = 'addon'
        if parameters.addon == 0 then
            thingstr = 'outfit'
        end
        if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
            npcHandler:say('Sorry, but this ' .. thingstr .. ' is only for premium players!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
            npcHandler:say('You already have this ' .. thingstr .. '!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (parameters.stID_outfit ~= 0) and (getPlayerStorageValue(cid, parameters.stID_outfit) == -1) then
            npcHandler:say('You must have this outfit first before buying addons!', 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] .. ' ' .. 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()
		if(getPlayerStorageValue(cid,addoninfo.storageID) ~= 1) then
			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 (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[i]
						doPlayerRemoveItem(cid,item[1],item[2])
					end
				end
				
				if getPlayerSex(cid) == PLAYERSEX_MALE then
					doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
				elseif getPlayerSex(cid) == PLAYERSEX_FEMALE then
					-- female addons fixes
					if addoninfo.outfit_female == 137 or addoninfo.outfit_female == 157 then
						if addoninfo.addon == 1 then
							addoninfo.addon = 2
						elseif addoninfo.addon == 2 then
							addoninfo.addon = 1
						end
					end
					-- end female addon fixes
					doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
				else
					npcHandler:say('Sorry, your sex is wrong.', cid)
					return true
				end
				setPlayerStorageValue(cid,addoninfo.storageID,1)
				npcHandler:say('Here you are.', cid)
			else
				npcHandler:say('You do not have needed items or cash!', cid)
			end
		else
			npcHandler:say('You already have this addon!', 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)
-- addon1 storage = 10001
-- addon2 storage = 10002
-- outfit storage = 0
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 = 10001, stID_outfit = 0})
    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 = 10002, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- hunter (done)
-- addon1 storage = 10003
-- addon2 storage = 10004
-- outfit storage = 0
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 = 10003, stID_outfit = 0})
    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 = 10004, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- knight (done)
-- addon1 storage = 10005
-- addon2 storage = 10006
-- outfit storage = 0
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 = 10005, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5893,100}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10006, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- mage (done)
-- addon1 storage = 10007
-- addon2 storage = 10008
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {2189,1}, {2187,1}, {5904,10}, {5809,1}, {2193,20}}, outfit_female = 141, outfit_male = 130, addon = 1, storageID = 10007, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5903,1}}, outfit_female = 141, outfit_male = 130, addon = 2, storageID = 10008, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 

-- summoner (done)
-- addon1 storage = 10009
-- addon2 storage = 10010
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5958,1}}, outfit_female = 138, outfit_male = 133, addon = 1, storageID = 10009, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5894,70}, {5911,20}, {5883,40}, {5922,35}, {5879,100}, {5881,60}, {5882,40}, {5904,15}, {5905,30}}, outfit_female = 138, outfit_male = 133, addon = 2, storageID = 10010, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 


-- barbarian (done)
-- addon1 storage = 10011
-- addon2 storage = 10012
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5892,1}, {5893,50}, {5876,50}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5884,1}, {5885,1}, {5910,50}, {5911,50}, {5879,100}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- druid (done)
-- addon1 storage = 10013
-- addon2 storage = 10014
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5896,50}, {5897,50}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5906,100}, {5939,1}, {5940,1}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- nobleman (done)
-- addon1 storage = 10015
-- addon2 storage = 10016
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- oriental (done)
-- addon1 storage = 10017
-- addon2 storage = 10018
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11423,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5883,100}, {5895,100}, {5891,2}, {5912,100}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- warrior (done)
-- addon1 storage = 10019
-- addon2 storage = 10020
-- outfit storage = 0
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 = 10019, stID_outfit = 0})
    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 = 10020, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- wizard (done)
-- addon1 storage = 10021
-- addon2 storage = 10022
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5922,50}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- assassin (done)
-- addon1 storage = 10023
-- addon2 storage = 10024
-- outfit storage = 10051
local outfit_node = keywordHandler:addKeyword({'first assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5879,100}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5804,1}, {5930,1}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'assassin outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5898,30}, {5882,10}, {5881,30}, {5885,1}, {5906,10}, {5905,20}, {5895,20}}, outfit_female = 156, outfit_male = 152, addon = 0, storageID = 10051, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- beggar (done)
-- addon1 storage = 10025
-- addon2 storage = 10026
-- outfit storage = 10052
local outfit_node = keywordHandler:addKeyword({'first beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 20000, items = {{5883,100}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6107,1}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'beggar outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5878,50}, {5921,30}, {5913,20}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 0, storageID = 10052, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- pirate (done) -
-- addon1 storage = 10027
-- addon2 storage = 10028
-- outfit storage = 10053
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 = 10027, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second pirate addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11426,1}, {6102,1}, {11425,1}, {11424,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'pirate outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6096,1}, {6095,1}, {5918,1}, {5462,1}}, outfit_female = 155, outfit_male = 151, addon = 0, storageID = 10053, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- shaman (done) - 
-- addon1 storage = 10029
-- addon2 storage = 10030
-- outfit storage = 10054
local outfit_node = keywordHandler:addKeyword({'first shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029, stID_outfit = 10054})
   outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030, stID_outfit = 10054})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- norseman (done) -- 
-- addon1 storage = 10031
-- addon2 storage = 10032
-- outfit storage = 10055
local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- jester (undone)
-- addon1 storage = 10033
-- addon2 storage = 10034
-- outfit storage = 10056

-- demonhunter (undone)
-- addon1 storage = 10035
-- addon2 storage = 10036
-- outfit storage = 10057

-- nightmare (done)
-- addon1 storage = 10037
-- addon2 storage = 10038
-- outfit storage = 10058
local outfit_node = keywordHandler:addKeyword({'first nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,500}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- brotherhood (done)
-- addon1 storage = 10039
-- addon2 storage = 10040
-- outfit storage = 10059
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 = 10039, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
    
-- yalaharian (undone)
-- addon1 storage = 10041
-- addon2 storage = 10041
-- outfit storage = 10060

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. Other addons can be obtained in quests.'})
keywordHandler:addKeyword({'outfits'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you assassin, beggar and pirate outfits. I can\'t give you the norseman, the yalaharian, the wayfarer, the jester, the nightmare and the brotherhood outfits for now.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'. For an outfit say \'NAME outfit\'.'})

npcHandler:addModule(FocusModule:new())
 
I will try, thanks man...

- - - Updated - - -

Man, this script don't works again.. Look some ex.:

21:18 Varkhal2: Greetings Teste. Will you help me? If you do, I'll reward you with nice addons! Just say addons, outfits or help if you don't know what to do.
21:18 Teste [1]: first summoner addon
21:18 Varkhal2: You already have this addon!
21:18 Teste [1]: yes
21:18 Varkhal2: You do not have needed items or cash!

kkk
 
Yeah i noticed when i tested too. This one seems to be working. I added one playerStorage key 10090 to control the talk.

Try this and if you find any other problem please tell me.

PHP:
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}, {outfits} 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
        local thingstr = 'addon'
        if parameters.addon == 0 then
            thingstr = 'outfit'
        end
        if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
            npcHandler:say('Sorry, but this ' .. thingstr .. ' is only for premium players!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
            npcHandler:say('You already have this ' .. thingstr .. '!', cid)
            npcHandler:resetNpc()
            return true
        end
        if (parameters.stID_outfit ~= 0) and (getPlayerStorageValue(cid, parameters.stID_outfit) == -1) then
            npcHandler:say('You must have this outfit first before buying addons!', 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] .. ' ' .. 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)
		setPlayerStorageValue(cid, 10090, 1)
        return true
    elseif (parameters.confirm == true and (getPlayerStorageValue(cid, 10090) > 0) then  
		setPlayerStorageValue(cid, 10090, 0)	
        local addonNode = node:getParent()
        local addoninfo = addonNode:getParameters()
        if(getPlayerStorageValue(cid,addoninfo.storageID) ~= 1) then
            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 (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[i]
                        doPlayerRemoveItem(cid,item[1],item[2])
                    end
                end
                
                if getPlayerSex(cid) == PLAYERSEX_MALE then
                    doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
                elseif getPlayerSex(cid) == PLAYERSEX_FEMALE then
                    -- female addons fixes
                    if addoninfo.outfit_female == 137 or addoninfo.outfit_female == 157 then
                        if addoninfo.addon == 1 then
                            addoninfo.addon = 2
                        elseif addoninfo.addon == 2 then
                            addoninfo.addon = 1
                        end
                    end
                    -- end female addon fixes
                    doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
                else
                    npcHandler:say('Sorry, your sex is wrong.', cid)
                    return true
                end
                setPlayerStorageValue(cid,addoninfo.storageID,1)
                npcHandler:say('Here you are.', cid)
            else
                npcHandler:say('You do not have needed items or cash!', cid)
            end
        else
            npcHandler:say('You already have this addon!', cid)
        end    
        npcHandler:resetNpc()
        return true
    elseif (parameters.decline == true) then
        npcHandler:say('Not interested? Maybe other addon?', cid)
		setPlayerStorageValue(cid, 10090, 0)
        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)
-- addon1 storage = 10001
-- addon2 storage = 10002
-- outfit storage = 0
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 = 10001, stID_outfit = 0})
    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 = 10002, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- hunter (done)
-- addon1 storage = 10003
-- addon2 storage = 10004
-- outfit storage = 0
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 = 10003, stID_outfit = 0})
    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 = 10004, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- knight (done)
-- addon1 storage = 10005
-- addon2 storage = 10006
-- outfit storage = 0
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 = 10005, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second knight addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5893,100}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10006, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- mage (done)
-- addon1 storage = 10007
-- addon2 storage = 10008
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {2189,1}, {2187,1}, {5904,10}, {5809,1}, {2193,20}}, outfit_female = 141, outfit_male = 130, addon = 1, storageID = 10007, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second mage addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5903,1}}, outfit_female = 141, outfit_male = 130, addon = 2, storageID = 10008, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 

-- summoner (done)
-- addon1 storage = 10009
-- addon2 storage = 10010
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5958,1}}, outfit_female = 138, outfit_male = 133, addon = 1, storageID = 10009, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 
local outfit_node = keywordHandler:addKeyword({'second summoner addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5894,70}, {5911,20}, {5883,40}, {5922,35}, {5879,100}, {5881,60}, {5882,40}, {5904,15}, {5905,30}}, outfit_female = 138, outfit_male = 133, addon = 2, storageID = 10010, stID_outfit = 0}) 
outfit_node:addChildKeywordNode(yesNode) 
outfit_node:addChildKeywordNode(noNode) 


-- barbarian (done)
-- addon1 storage = 10011
-- addon2 storage = 10012
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5880,100}, {5892,1}, {5893,50}, {5876,50}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second barbarian addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5884,1}, {5885,1}, {5910,50}, {5911,50}, {5879,100}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- druid (done)
-- addon1 storage = 10013
-- addon2 storage = 10014
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5896,50}, {5897,50}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second druid addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5906,100}, {5939,1}, {5940,1}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- nobleman (done)
-- addon1 storage = 10015
-- addon2 storage = 10016
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nobleman addon'}, playerBuyAddonNPC, {premium = true, cost = 150000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- oriental (done)
-- addon1 storage = 10017
-- addon2 storage = 10018
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11423,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second oriental addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5883,100}, {5895,100}, {5891,2}, {5912,100}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- warrior (done)
-- addon1 storage = 10019
-- addon2 storage = 10020
-- outfit storage = 0
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 = 10019, stID_outfit = 0})
    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 = 10020, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- wizard (done)
-- addon1 storage = 10021
-- addon2 storage = 10022
-- outfit storage = 0
local outfit_node = keywordHandler:addKeyword({'first wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5922,50}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- assassin (done)
-- addon1 storage = 10023
-- addon2 storage = 10024
-- outfit storage = 10051
local outfit_node = keywordHandler:addKeyword({'first assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5912,50}, {5910,50}, {5911,50}, {5913,50}, {5914,50}, {5909,50}, {5879,100}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second assassin addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5804,1}, {5930,1}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024, stID_outfit = 10051})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'assassin outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5898,30}, {5882,10}, {5881,30}, {5885,1}, {5906,10}, {5905,20}, {5895,20}}, outfit_female = 156, outfit_male = 152, addon = 0, storageID = 10051, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- beggar (done)
-- addon1 storage = 10025
-- addon2 storage = 10026
-- outfit storage = 10052
local outfit_node = keywordHandler:addKeyword({'first beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 20000, items = {{5883,100}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second beggar addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6107,1}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026, stID_outfit = 10052})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'beggar outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5878,50}, {5921,30}, {5913,20}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 0, storageID = 10052, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- pirate (done) -
-- addon1 storage = 10027
-- addon2 storage = 10028
-- outfit storage = 10053
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 = 10027, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second pirate addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{11426,1}, {6102,1}, {11425,1}, {11424,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028, stID_outfit = 10053})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'pirate outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6096,1}, {6095,1}, {5918,1}, {5462,1}}, outfit_female = 155, outfit_male = 151, addon = 0, storageID = 10053, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- shaman (done) - 
-- addon1 storage = 10029
-- addon2 storage = 10030
-- outfit storage = 10054
local outfit_node = keywordHandler:addKeyword({'first shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029, stID_outfit = 10054})
   outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second shaman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030, stID_outfit = 10054})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- norseman (done) -- 
-- addon1 storage = 10031
-- addon2 storage = 10032
-- outfit storage = 10055
local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032, stID_outfit = 10055})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- jester (undone)
-- addon1 storage = 10033
-- addon2 storage = 10034
-- outfit storage = 10056

-- demonhunter (undone)
-- addon1 storage = 10035
-- addon2 storage = 10036
-- outfit storage = 10057

-- nightmare (done)
-- addon1 storage = 10037
-- addon2 storage = 10038
-- outfit storage = 10058
local outfit_node = keywordHandler:addKeyword({'first nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,500}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second nightmare addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038, stID_outfit = 10058})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)

-- brotherhood (done)
-- addon1 storage = 10039
-- addon2 storage = 10040
-- outfit storage = 10059
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 = 10039, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second brotherhood addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{6500,1000}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040, stID_outfit = 10059})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
    
-- yalaharian (undone)
-- addon1 storage = 10041
-- addon2 storage = 10041
-- outfit storage = 10060
-- verification storage = 10090

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. Other addons can be obtained in quests.'})
keywordHandler:addKeyword({'outfits'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can give you assassin, beggar and pirate outfits. I can\'t give you the norseman, the yalaharian, the wayfarer, the jester, the nightmare and the brotherhood outfits for now.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'To get the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'. For an outfit say \'NAME outfit\'.'})

npcHandler:addModule(FocusModule:new())
 
Hey! the bug is fixed \o But I have just more one problem.. Look:

10:45 Teste [1]: hi
10:45 Varkhal2: Greetings Teste. Will you help me? If you do, I'll reward you with nice addons! Just say addons, outfits or help if you don't know what to do.
10:45 Teste [1]: first norseman addon
10:45 Varkhal2: You must have this outfit first before buying addons!
10:45 Teste [1]: norseman outfit
10:45 Varkhal2: Not interested? Maybe other addon?

I added the norseman outfit to the script:

PHP:
-- norseman (done) - custom quest for outfit
-- addon1 storage = 10031
-- addon2 storage = 10032
-- outfit storage = 10055
local outfit_node = keywordHandler:addKeyword({'norseman outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7955,1}}, outfit_female = 252, outfit_male = 251, addon = 0, storageID = 10055, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031, stID_outfit = 10055})
	outfit_node:addChildKeywordNode(yesNode)
	outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032, stID_outfit = 10055})
	outfit_node:addChildKeywordNode(yesNode)
	outfit_node:addChildKeywordNode(noNode)

Look more one Ex.:

10:48 Teste [1]: first norseman addon
10:48 Varkhal2: You must have this outfit first before buying addons!
10:48 Teste [1]: second norseman addon
10:48 Varkhal2: Not interested? Maybe other addon?
10:48 Teste [1]: norseman outfit
10:48 Varkhal2: Not interested? Maybe other addon?
10:48 Teste [1]: bye
10:48 Varkhal2: Good bye, Teste!
10:48 Teste [1]: hi
10:48 Varkhal2: Greetings Teste. Will you help me? If you do, I'll reward you with nice addons! Just say addons, outfits or help if you don't know what to do.
10:48 Teste [1]: norseman outfit
10:48 Varkhal2: Did you bring me 1 package with clothes for norseman outfit?

When I ask him some addon, and after this I ask the norseman outfit, the npc just stay in "Not interested? Maybe other addon?" condition... To make this works I need to end the conversation and begin again, like I did in the ex.. Some idea? And thanks man!
 
Last edited:
Hey! the bug is fixed \o But I have just more one problem.. Look:



I added the norseman outfit to the script:

PHP:
-- norseman (done) - custom quest for outfit
-- addon1 storage = 10031
-- addon2 storage = 10032
-- outfit storage = 10055
local outfit_node = keywordHandler:addKeyword({'norseman outfit'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7955,1}}, outfit_female = 252, outfit_male = 251, addon = 0, storageID = 10055, stID_outfit = 0})
    outfit_node:addChildKeywordNode(yesNode)
    outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'first norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031, stID_outfit = 10055})
	outfit_node:addChildKeywordNode(yesNode)
	outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second norseman addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032, stID_outfit = 10055})
	outfit_node:addChildKeywordNode(yesNode)
	outfit_node:addChildKeywordNode(noNode)

Look more one Ex.:



When I ask him some addon, and after this I ask the norseman outfit, the npc just stay in "Not interested? Maybe other addon?" condition... To make this works I need to end the conversation and begin again, like I did in the ex.. Some idea? And thanks man!


It´s because the script is recognizing the word 'norseman outfit' as no because the first two letter of this is 'no'. So change the keyword for this outfit like 'the norseman outfit' and see what happens :)
 
Back
Top