• 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!

Solved NPC addoner dont give addons

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i have this problem, wich gives no error in console, and i cant figure why it doesnt work!

here is the code of the npc, and outfits xml line

This is a working example:
Code:
['first citizen addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10042},
['second citizen addon'] = {cost = 0, items = {{5890,50}, {5902,25}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10043},


Code:
<outfit type="0" looktype="136" name="Citizen" premium="0" unlocked="1" enabled="1" />
<outfit type="1" looktype="128" name="Citizen" premium="0" unlocked="1" enabled="1" />

and this is an example of an outfit that doesnt work:

Code:
['first pharao addon'] = {cost = 0, items = {{2348,20}}, outfit_female = 956, outfit_male = 955, addon = 1, storageID = 10129},
['second pharao addon'] = {cost = 0, items = {{2139,20}}, outfit_female = 956, outfit_male = 955, addon = 2, storageID = 10130},

Code:
<outfit type="0" looktype="956" name="Pharao" premium="1" unlocked="1" enabled="1" />
<outfit type="1" looktype="955" name="Pharao" premium="1" unlocked="1" enabled="1" />

Also here is the full npc script

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
local talkState = {}
local rtnt = {}
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|. I need your help and I'll reward you with nice addons if you help me! Just say {addons} or {help} if you don't know what to do.")
addoninfo = {
['first citizen addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10042},
['second citizen addon'] = {cost = 0, items = {{5890,50}, {5902,25}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10043},
['first hunter addon'] = {cost = 0, items = {{5876,50}, {5948,50}, {5891,5}, {5887,1}, {5889,1}, {5888,1}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 10044},
['second hunter addon'] = {cost = 0, items = {{5875,1}}, outfit_female = 137, outfit_male = 129, addon = 2, storageID = 10045},
['first knight addon'] = {cost = 0, items = {{5880,50}, {5892,1}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 10046},
['second knight addon'] = {cost = 0, items = {{5893,50}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10047},
['first mage addon'] = {cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {2392,30}, {5809,1}, {2193,20}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 10048},
['second mage addon'] = {cost = 0, items = {{5903,1}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 10049},
['first summoner addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 10050},
['second summoner addon'] = {cost = 0, items = {{5894,35}, {5911,20}, {5883,40}, {5922,35}, {5879,10}, {5881,30}, {5882,40}, {2392,3}, {5905,30}}, outfit_female = 141, outfit_male = 133, addon = 2, storageID = 10051},
['first barbarian addon'] = {cost = 0, items = {{5884,1}, {5885,1}, {5910,25}, {5911,25}, {5886,10}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011},
['second barbarian addon'] = {cost = 0, items = {{5880,25}, {5892,1}, {5893,25}, {5876,25}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012},
['first druid addon'] = {cost = 0, items = {{5896,20}, {5897,20}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013},
['second druid addon'] = {cost = 0, items = {{5906,100}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014},
['first nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015},
['second nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016},
['first oriental addon'] = {cost = 0, items = {{9020,5}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017},
['second oriental addon'] = {cost = 0, items = {{5883,30}, {5895,30}, {5891,2}, {5912,30}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018},
['first warrior addon'] = {cost = 0, items = {{5925,40}, {5899,40}, {5884,1}, {5919,1}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 10019},
['second warrior addon'] = {cost = 0, items = {{5880,40}, {5887,1}}, outfit_female = 142, outfit_male = 134, addon = 2, storageID = 10020},
['first wizard addon'] = {cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021},
['second wizard addon'] = {cost = 0, items = {{5922,40}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022},
['first assassin addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5913,20}, {5914,20}, {5909,20}, {5886,10}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023},
['second assassin addon'] = {cost = 0, items = {{5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024},
['first beggar addon'] = {cost = 0, items = {{5878,30}, {5921,20}, {5913,10}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025},
['second beggar addon'] = {cost = 0, items = {{5883,30}, {2160,2}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026},
['first pirate addon'] = {cost = 0, items = {{6098,30}, {6126,30}, {6097,30}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 10027},
['second pirate addon'] = {cost = 0, items = {{6101,1}, {6102,1}, {6100,1}, {6099,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028},
['first shaman addon'] = {cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029},
['second shaman addon'] = {cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030},
['first norseman addon'] = {cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031},
['second norseman addon'] = {cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032},
['first jester addon'] = {cost = 0, items = {{5912,20}, {5913,20}, {5914,20}, {5909,20}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 10033},
['second jester addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5912,20}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 10034},
['first demonhunter addon'] = {cost = 0, items = {{5905,30}, {5906,40}, {5954,20}, {6500,50}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 10035},
['second demonhunter addon'] = {cost = 0, items = {{5906,50}, {6500,200}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 10036},
['first nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037},
['second nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038},
['first brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 1, storageID = 10039},
['second brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040},
['first yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 10041},
['second yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 2, storageID = 10052},
['first warmaster addon'] = {cost = 0, items = {{11325,200}}, outfit_female = 336, outfit_male = 335, addon = 1, storageID = 10053},
['second warmaster addon'] = {cost = 0, items = {{11245,200}}, outfit_female = 336, outfit_male = 335, addon = 2, storageID = 10054},
['first wayfarer addon'] = {cost = 0, items = {{11334,300}}, outfit_female = 366, outfit_male = 367, addon = 1, storageID = 10055},
['second wayfarer addon'] = {cost = 0, items = {{10549,100}}, outfit_female = 366, outfit_male = 367, addon = 2, storageID = 10056},
['first afflicted addon'] = {cost = 0, items = {{13541,300}}, outfit_female = 431, outfit_male = 430, addon = 1, storageID = 10057},
['second afflicted addon'] = {cost = 0, items = {{13544,300}}, outfit_female = 431, outfit_male = 430, addon = 2, storageID = 10058},
['first elementalist addon'] = {cost = 0, items = {{13758,80}}, outfit_female = 433, outfit_male = 432, addon = 1, storageID = 10059},
['second elementalist addon'] = {cost = 0, items = {{8900,2}}, outfit_female = 433, outfit_male = 432, addon = 2, storageID = 10060},
['first deepling addon'] = {cost = 0, items = {{15411,1}}, outfit_female = 464, outfit_male = 463, addon = 1, storageID = 10061},
['second deepling addon'] = {cost = 0, items = {{15404,1}}, outfit_female = 464, outfit_male = 463, addon = 2, storageID = 10062},
['first insectoid addon'] = {cost = 0, items = {{16096,10}}, outfit_female = 466, outfit_male = 465, addon = 1, storageID = 10063},
['second insectoid addon'] = {cost = 0, items = {{15480,250}}, outfit_female = 466, outfit_male = 465, addon = 2, storageID = 10064},
['first entrepreneur addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 471, outfit_male = 472, addon = 1, storageID = 10065},
['second entrepreneur addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 471, outfit_male = 472, addon = 2, storageID = 10066},
['first crystal warlord addon'] = {cost = 0, items = {{18432,430}}, outfit_female = 513, outfit_male = 512, addon = 1, storageID = 10067},
['second crystal warlord addon'] = {cost = 0, items = {{18431,200}}, outfit_female = 513, outfit_male = 512, addon = 2, storageID = 10068},
['first soil guardian addon'] = {cost = 0, items = {{18433,350}}, outfit_female = 514, outfit_male = 516, addon = 1, storageID = 10069},
['second soil guardian addon'] = {cost = 0, items = {{18436,200}}, outfit_female = 514, outfit_male = 516, addon = 2, storageID = 10070},
['first demon addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 542, outfit_male = 541, addon = 1, storageID = 10071},
['second demon addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 542, outfit_male = 541, addon = 2, storageID = 10072},
['first cave explorer addon'] = {cost = 0, items = {{22541,200}}, outfit_female = 575, outfit_male = 574, addon = 1, storageID = 10073},
['second cave explorer addon'] = {cost = 0, items = {{22539,200}}, outfit_female = 575, outfit_male = 574, addon = 2, storageID = 10074},
['first dream warden addon'] = {cost = 0, items = {{22534,200}}, outfit_female = 578, outfit_male = 577, addon = 1, storageID = 10075},
['second dream warden addon'] = {cost = 0, items = {{22536,300}}, outfit_female = 578, outfit_male = 577, addon = 2, storageID = 10076},
['first glooth engineer addon'] = {cost = 0, items = {{23567,300}}, outfit_female = 618, outfit_male = 610, addon = 1, storageID = 10077},
['second glooth engineer addon'] = {cost = 0, items = {{23514,200}}, outfit_female = 618, outfit_male = 610, addon = 2, storageID = 10078},
['first champion addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 632, outfit_male = 633, addon = 1, storageID = 10079},
['second champion addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 632, outfit_male = 633, addon = 2, storageID = 10080},
['first conjurer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 635, outfit_male = 634, addon = 1, storageID = 10081},
['second conjurer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 635, outfit_male = 634, addon = 2, storageID = 10082},
['first beastmaster addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 636, outfit_male = 637, addon = 1, storageID = 10083},
['second beastmaster addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 636, outfit_male = 637, addon = 2, storageID = 10084},
['first chaos acolyt addon'] = {cost = 0, items = {{26191,200}}, outfit_female = 664, outfit_male = 665, addon = 1, storageID = 10085},
['second chaos acolyt addon'] = {cost = 0, items = {{26201,200}}, outfit_female = 664, outfit_male = 665, addon = 2, storageID = 10086},
['first death herald addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 666, outfit_male = 667, addon = 1, storageID = 10087},
['second death herald addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 666, outfit_male = 667, addon = 2, storageID = 10088},
['first ranger addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 683, outfit_male = 684, addon = 1, storageID = 10089},
['second ranger addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 683, outfit_male = 684, addon = 2, storageID = 10090},
['first ceremonial garb addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 694, outfit_male = 695, addon = 1, storageID = 10091},
['second ceremonial garb addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 694, outfit_male = 695, addon = 2, storageID = 10092},
['first puppeteer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 696, outfit_male = 697, addon = 1, storageID = 10093},
['second puppeteer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 696, outfit_male = 697, addon = 2, storageID = 10094},
['first spirit caller addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 698, outfit_male = 699, addon = 1, storageID = 10095},
['second spirit caller addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 698, outfit_male = 699, addon = 2, storageID = 10096},
['first evoker addon'] = {cost = 0, items = {{5894,300}}, outfit_female = 724, outfit_male = 725, addon = 1, storageID = 10097},
['second evoker addon'] = {cost = 0, items = {{5894,300}}, outfit_female = 724, outfit_male = 725, addon = 2, storageID = 10098},
['first seaweaver addon'] = {cost = 0, items = {{15430,300}}, outfit_female = 732, outfit_male = 733, addon = 1, storageID = 10099},
['second seaweaver addon'] = {cost = 0, items = {{13870,200}}, outfit_female = 732, outfit_male = 733, addon = 2, storageID = 10100},
['first recruiter addon'] = {cost = 0, items = {{6547,300}}, outfit_female = 745, outfit_male = 746, addon = 1, storageID = 10101},
['second recruiter addon'] = {cost = 0, items = {{6548,300}}, outfit_female = 745, outfit_male = 746, addon = 2, storageID = 10102},
['first sea dog addon'] = {cost = 0, items = {{11219,200}}, outfit_female = 749, outfit_male = 750, addon = 1, storageID = 10103},
['second sea dog addon'] = {cost = 0, items = {{6098,200}}, outfit_female = 749, outfit_male = 750, addon = 2, storageID = 10104},
['first royal pumpkin addon'] = {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 1, storageID = 10105},
['second royal pumpkin addon'] = {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 2, storageID = 10106},
['first rift warrior addon'] = {cost = 0, items = {{5954,800}}, outfit_female = 845, outfit_male = 846, addon = 1, storageID = 10107},
['second rift warrior addon'] = {cost = 0, items = {{5948,800}}, outfit_female = 845, outfit_male = 846, addon = 2, storageID = 10108},
['first winter warden addon'] = {cost = 0, items = {{10578,200}}, outfit_female = 852, outfit_male = 853, addon = 1, storageID = 10109},
['second winter warden addon'] = {cost = 0, items = {{2396,20}}, outfit_female = 852, outfit_male = 853, addon = 2, storageID = 10110},
['first philosopher addon'] = {cost = 0, items = {{20102,200}}, outfit_female = 874, outfit_male = 873, addon = 1, storageID = 10111},
['second philosopher addon'] = {cost = 0, items = {{20110,200}}, outfit_female = 874, outfit_male = 873, addon = 2, storageID = 10112},
['first arena champion addon'] = {cost = 0, items = {{18425,200}}, outfit_female = 884, outfit_male = 885, addon = 1, storageID = 10113},
['second arena champion addon'] = {cost = 0, items = {{3976,800}}, outfit_female = 884, outfit_male = 885, addon = 2, storageID = 10114},
['first lupine warden addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 1, storageID = 10115},
['second lupine warden addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 2, storageID = 10116},
['first grove keeper addon'] = {cost = 0, items = {{13533,100}}, outfit_female = 909, outfit_male = 908, addon = 1, storageID = 10117},
['second grove keeper addon'] = {cost = 0, items = {{13534,100}}, outfit_female = 909, outfit_male = 908, addon = 2, storageID = 10118},
['first pharao addon'] = {cost = 0, items = {{2348,20}}, outfit_female = 956, outfit_male = 955, addon = 1, storageID = 10129},
['second pharao addon'] = {cost = 0, items = {{2139,20}}, outfit_female = 956, outfit_male = 955, addon = 2, storageID = 10130},
['first festive addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 1, storageID = 10121},
['second festive addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 2, storageID = 10122},
['first trophy hunter addon'] = {cost = 0, items = {{12431,20}}, outfit_female = 958, outfit_male = 957, addon = 1, storageID = 10123},
['second trophy hunter addon'] = {cost = 0, items = {{5943,5}}, outfit_female = 958, outfit_male = 957, addon = 2, storageID = 10124},
['first herbalist addon'] = {cost = 0, items = {{29474,20}}, outfit_female = 1078, outfit_male = 1079, addon = 1, storageID = 10125},
['second herbalist addon'] = {cost = 0, items = {{29475,20}}, outfit_female = 1078, outfit_male = 1079, addon = 2, storageID = 10126},


-- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052 --
}
local o = {'citizen', 'hunter', 'knight', 'mage', 'nobleman', 'summoner', 'warrior', 'barbarian', 'druid', 'wizard', 'oriental', 'pirate', 'assassin', 'beggar',
'shaman', 'norseman', 'nightmare', 'jester', 'yalaharian', 'brotherhood', 'demonhunter', 'warmaster',
'wayfarer', 'afflicted', 'elementalist', 'deepling', 'insectoid', 'entrepreneur', 'crystal warlord', 'soil guardian', 'demon', 'cave explorer', 'dream warden',
'glooth engineer', 'champion', 'conjurer', 'beastmaster', 'chaos acolyt', 'death herald', 'ranger', 'ceremonial garb', 'puppeteer', 'spirit caller',
'evoker', 'seaweaver', 'recruiter', 'sea dog', 'royal pumpkin', 'rift warrior', 'winter warden', 'philosopher', 'arena champion', 'lupine warden', 'grove keeper',
'pharao', 'festive', 'trophy hunter', 'herbalist'}
function creatureSayCallback(cid, type, msg)
local talkUser = cid
        if(not npcHandler:isFocused(cid)) then
                return false
        end
        if addoninfo[msg] ~= nil then
                if (getPlayerStorageValue(cid, addoninfo[msg].storageID) ~= -1) then
                                npcHandler:say('You already have this addon!', cid)
                                npcHandler:resetNpc()
                else
                local itemsTable = addoninfo[msg].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] .. ' ' .. ItemType(item[1]):getName()
                                        if i ~= table.maxn(itemsTable) then
                                                items_list = items_list .. ', '
                                        end
                                end
                        end
                local text = ''
                        if (addoninfo[msg].cost > 0) then
                                text = addoninfo[msg].cost .. ' gp'
                        elseif table.maxn(addoninfo[msg].items) then
                                text = items_list
                        elseif (addoninfo[msg].cost > 0) and table.maxn(addoninfo[msg].items) then
                                text = items_list .. ' and ' .. addoninfo[msg].cost .. ' gp'
                        end
                        npcHandler:say('For ' .. msg .. ' you will need ' .. text .. '. Do you have it all with you?', cid)
                        rtnt[talkUser] = msg
                        talkState[talkUser] = addoninfo[msg].storageID
                        return true
                end
        elseif msgcontains(msg, "yes") then
                if (talkState[talkUser] > 10010 and talkState[talkUser] < 10100) then
                        local items_number = 0
                        if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then
                                for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do
                                        local item = addoninfo[rtnt[talkUser]].items[i]
                                        if (getPlayerItemCount(cid,item[1]) >= item[2]) then
                                                items_number = items_number + 1
                                        end
                                end
                        end
                        if(getPlayerMoney(cid) >= addoninfo[rtnt[talkUser]].cost) and (items_number == table.maxn(addoninfo[rtnt[talkUser]].items)) then
                                doPlayerRemoveMoney(cid, addoninfo[rtnt[talkUser]].cost)
                                if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then
                                        for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do
                                                local item = addoninfo[rtnt[talkUser]].items[i]
                                                doPlayerRemoveItem(cid,item[1],item[2])
                                        end
                                end
                                doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_male, addoninfo[rtnt[talkUser]].addon)
                                doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_female, addoninfo[rtnt[talkUser]].addon)
                                setPlayerStorageValue(cid,addoninfo[rtnt[talkUser]].storageID,1)
                                npcHandler:say('Here you are.', cid)
                        else
                                npcHandler:say('You do not have needed items!', cid)
                        end
                        rtnt[talkUser] = nil
                        talkState[talkUser] = 0
                        npcHandler:resetNpc()
                        return true
                end
        elseif msgcontains(msg, "addon") then
                npcHandler:say('I can give you addons for {' .. table.concat(o, "}, {") .. '} outfits.', cid)
                rtnt[talkUser] = nil
                talkState[talkUser] = 0
                npcHandler:resetNpc()
                return true
        elseif msgcontains(msg, "help") then
                npcHandler:say('To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.', cid)
                rtnt[talkUser] = nil
                talkState[talkUser] = 0
                npcHandler:resetNpc()
                return true
        else
                if talkState[talkUser] ~= nil then
                        if talkState[talkUser] > 0 then
                        npcHandler:say('Come back when you get these items.', cid)
                        rtnt[talkUser] = nil
                        talkState[talkUser] = 0
                        npcHandler:resetNpc()
                        return true
                        end
                end
        end
        return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


and this is what happens when i try to get the addons:
e9431e7581267062a60376c2c4121936.png


and after i say yes, nothing happens, my items are not removed and i dont get any addons, i really can't find the problem D:

plz guys help

what i have tried:
-changinf the storage value.
-changing the item that is requested.
 
Last edited:
Solution
Here is my suggested edit due to character count limit on boards of 25k letters.
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
local talkState = {}
local rtnt = {}

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|. I need your help and I'll reward you with nice addons if you help me! Just say...
Bump
anyone any ideas? also i can wear the pharao outfit with full addons with my gm, so in dat it's fine
 
Plz anyone?? no one knows the solution? D;
line 168
Lua:
talkState[talkUser] = addoninfo[msg].storageID
line 172
Lua:
if (talkState[talkUser] > 10010 and talkState[talkUser] < 10100) then

That means all of these outfits won't work.
Lua:
['first recruiter addon'] =       {cost = 0, items = {{6547,300}}, outfit_female = 745, outfit_male = 746, addon = 1, storageID = 10101},
['second recruiter addon'] =      {cost = 0, items = {{6548,300}}, outfit_female = 745, outfit_male = 746, addon = 2, storageID = 10102},
['first sea dog addon'] =         {cost = 0, items = {{11219,200}}, outfit_female = 749, outfit_male = 750, addon = 1, storageID = 10103},
['second sea dog addon'] =        {cost = 0, items = {{6098,200}}, outfit_female = 749, outfit_male = 750, addon = 2, storageID = 10104},
['first royal pumpkin addon'] =   {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 1, storageID = 10105},
['second royal pumpkin addon'] =  {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 2, storageID = 10106},
['first rift warrior addon'] =    {cost = 0, items = {{5954,800}}, outfit_female = 845, outfit_male = 846, addon = 1, storageID = 10107},
['second rift warrior addon'] =   {cost = 0, items = {{5948,800}}, outfit_female = 845, outfit_male = 846, addon = 2, storageID = 10108},
['first winter warden addon'] =   {cost = 0, items = {{10578,200}}, outfit_female = 852, outfit_male = 853, addon = 1, storageID = 10109},
['second winter warden addon'] =  {cost = 0, items = {{2396,20}}, outfit_female = 852, outfit_male = 853, addon = 2, storageID = 10110},
['first philosopher addon'] =     {cost = 0, items = {{20102,200}}, outfit_female = 874, outfit_male = 873, addon = 1, storageID = 10111},
['second philosopher addon'] =    {cost = 0, items = {{20110,200}}, outfit_female = 874, outfit_male = 873, addon = 2, storageID = 10112},
['first arena champion addon'] =  {cost = 0, items = {{18425,200}}, outfit_female = 884, outfit_male = 885, addon = 1, storageID = 10113},
['second arena champion addon'] = {cost = 0, items = {{3976,800}}, outfit_female = 884, outfit_male = 885, addon = 2, storageID = 10114},
['first lupine warden addon'] =   {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 1, storageID = 10115},
['second lupine warden addon'] =  {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 2, storageID = 10116},
['first grove keeper addon'] =    {cost = 0, items = {{13533,100}}, outfit_female = 909, outfit_male = 908, addon = 1, storageID = 10117},
['second grove keeper addon'] =   {cost = 0, items = {{13534,100}}, outfit_female = 909, outfit_male = 908, addon = 2, storageID = 10118},
['first pharao addon'] =          {cost = 0, items = {{2348,20}}, outfit_female = 956, outfit_male = 955, addon = 1, storageID = 10129},
['second pharao addon'] =         {cost = 0, items = {{2139,20}}, outfit_female = 956, outfit_male = 955, addon = 2, storageID = 10130},
['first festive addon'] =         {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 1, storageID = 10121},
['second festive addon'] =        {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 2, storageID = 10122},
['first trophy hunter addon'] =   {cost = 0, items = {{12431,20}}, outfit_female = 958, outfit_male = 957, addon = 1, storageID = 10123},
['second trophy hunter addon'] =  {cost = 0, items = {{5943,5}}, outfit_female = 958, outfit_male = 957, addon = 2, storageID = 10124},
['first herbalist addon'] =       {cost = 0, items = {{29474,20}}, outfit_female = 1078, outfit_male = 1079, addon = 1, storageID = 10125},
['second herbalist addon'] =      {cost = 0, items = {{29475,20}}, outfit_female = 1078, outfit_male = 1079, addon = 2, storageID = 10126},
 
Last edited:
Here is my suggested edit due to character count limit on boards of 25k letters.
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
local talkState = {}
local rtnt = {}

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|. I need your help and I'll reward you with nice addons if you help me! Just say {addons} or {help} if you don't know what to do.")

addoninfo = {
    ['first citizen addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10042},
    ['second citizen addon'] = {cost = 0, items = {{5890,50}, {5902,25}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10043},
    ['first hunter addon'] = {cost = 0, items = {{5876,50}, {5948,50}, {5891,5}, {5887,1}, {5889,1}, {5888,1}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 10044},
    ['second hunter addon'] = {cost = 0, items = {{5875,1}}, outfit_female = 137, outfit_male = 129, addon = 2, storageID = 10045},
    ['first knight addon'] = {cost = 0, items = {{5880,50}, {5892,1}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 10046},
    ['second knight addon'] = {cost = 0, items = {{5893,50}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10047},
    ['first mage addon'] = {cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {2392,30}, {5809,1}, {2193,20}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 10048},
    ['second mage addon'] = {cost = 0, items = {{5903,1}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 10049},
    ['first summoner addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 10050},
    ['second summoner addon'] = {cost = 0, items = {{5894,35}, {5911,20}, {5883,40}, {5922,35}, {5879,10}, {5881,30}, {5882,40}, {2392,3}, {5905,30}}, outfit_female = 141, outfit_male = 133, addon = 2, storageID = 10051},
    ['first barbarian addon'] = {cost = 0, items = {{5884,1}, {5885,1}, {5910,25}, {5911,25}, {5886,10}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011},
    ['second barbarian addon'] = {cost = 0, items = {{5880,25}, {5892,1}, {5893,25}, {5876,25}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012},
    ['first druid addon'] = {cost = 0, items = {{5896,20}, {5897,20}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013},
    ['second druid addon'] = {cost = 0, items = {{5906,100}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014},
    ['first nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015},
    ['second nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016},
    ['first oriental addon'] = {cost = 0, items = {{9020,5}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017},
    ['second oriental addon'] = {cost = 0, items = {{5883,30}, {5895,30}, {5891,2}, {5912,30}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018},
    ['first warrior addon'] = {cost = 0, items = {{5925,40}, {5899,40}, {5884,1}, {5919,1}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 10019},
    ['second warrior addon'] = {cost = 0, items = {{5880,40}, {5887,1}}, outfit_female = 142, outfit_male = 134, addon = 2, storageID = 10020},
    ['first wizard addon'] = {cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021},
    ['second wizard addon'] = {cost = 0, items = {{5922,40}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022},
    ['first assassin addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5913,20}, {5914,20}, {5909,20}, {5886,10}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023},
    ['second assassin addon'] = {cost = 0, items = {{5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024},
    ['first beggar addon'] = {cost = 0, items = {{5878,30}, {5921,20}, {5913,10}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025},
    ['second beggar addon'] = {cost = 0, items = {{5883,30}, {2160,2}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026},
    ['first pirate addon'] = {cost = 0, items = {{6098,30}, {6126,30}, {6097,30}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 10027},
    ['second pirate addon'] = {cost = 0, items = {{6101,1}, {6102,1}, {6100,1}, {6099,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028},
    ['first shaman addon'] = {cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029},
    ['second shaman addon'] = {cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030},
    ['first norseman addon'] = {cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031},
    ['second norseman addon'] = {cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032},
    ['first jester addon'] = {cost = 0, items = {{5912,20}, {5913,20}, {5914,20}, {5909,20}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 10033},
    ['second jester addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5912,20}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 10034},
    ['first demonhunter addon'] = {cost = 0, items = {{5905,30}, {5906,40}, {5954,20}, {6500,50}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 10035},
    ['second demonhunter addon'] = {cost = 0, items = {{5906,50}, {6500,200}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 10036},
    ['first nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037},
    ['second nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038},
    ['first brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 1, storageID = 10039},
    ['second brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040},
    ['first yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 10041},
    ['second yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 2, storageID = 10052},
    ['first warmaster addon'] = {cost = 0, items = {{11325,200}}, outfit_female = 336, outfit_male = 335, addon = 1, storageID = 10053},
    ['second warmaster addon'] = {cost = 0, items = {{11245,200}}, outfit_female = 336, outfit_male = 335, addon = 2, storageID = 10054},
    ['first wayfarer addon'] = {cost = 0, items = {{11334,300}}, outfit_female = 366, outfit_male = 367, addon = 1, storageID = 10055},
    ['second wayfarer addon'] = {cost = 0, items = {{10549,100}}, outfit_female = 366, outfit_male = 367, addon = 2, storageID = 10056},
    ['first afflicted addon'] = {cost = 0, items = {{13541,300}}, outfit_female = 431, outfit_male = 430, addon = 1, storageID = 10057},
    ['second afflicted addon'] = {cost = 0, items = {{13544,300}}, outfit_female = 431, outfit_male = 430, addon = 2, storageID = 10058},
    ['first elementalist addon'] = {cost = 0, items = {{13758,80}}, outfit_female = 433, outfit_male = 432, addon = 1, storageID = 10059},
    ['second elementalist addon'] = {cost = 0, items = {{8900,2}}, outfit_female = 433, outfit_male = 432, addon = 2, storageID = 10060},
    ['first deepling addon'] = {cost = 0, items = {{15411,1}}, outfit_female = 464, outfit_male = 463, addon = 1, storageID = 10061},
    ['second deepling addon'] = {cost = 0, items = {{15404,1}}, outfit_female = 464, outfit_male = 463, addon = 2, storageID = 10062},
    ['first insectoid addon'] = {cost = 0, items = {{16096,10}}, outfit_female = 466, outfit_male = 465, addon = 1, storageID = 10063},
    ['second insectoid addon'] = {cost = 0, items = {{15480,250}}, outfit_female = 466, outfit_male = 465, addon = 2, storageID = 10064},
    ['first entrepreneur addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 471, outfit_male = 472, addon = 1, storageID = 10065},
    ['second entrepreneur addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 471, outfit_male = 472, addon = 2, storageID = 10066},
    ['first crystal warlord addon'] = {cost = 0, items = {{18432,430}}, outfit_female = 513, outfit_male = 512, addon = 1, storageID = 10067},
    ['second crystal warlord addon'] = {cost = 0, items = {{18431,200}}, outfit_female = 513, outfit_male = 512, addon = 2, storageID = 10068},
    ['first soil guardian addon'] = {cost = 0, items = {{18433,350}}, outfit_female = 514, outfit_male = 516, addon = 1, storageID = 10069},
    ['second soil guardian addon'] = {cost = 0, items = {{18436,200}}, outfit_female = 514, outfit_male = 516, addon = 2, storageID = 10070},
    ['first demon addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 542, outfit_male = 541, addon = 1, storageID = 10071},
    ['second demon addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 542, outfit_male = 541, addon = 2, storageID = 10072},
    ['first cave explorer addon'] = {cost = 0, items = {{22541,200}}, outfit_female = 575, outfit_male = 574, addon = 1, storageID = 10073},
    ['second cave explorer addon'] = {cost = 0, items = {{22539,200}}, outfit_female = 575, outfit_male = 574, addon = 2, storageID = 10074},
    ['first dream warden addon'] = {cost = 0, items = {{22534,200}}, outfit_female = 578, outfit_male = 577, addon = 1, storageID = 10075},
    ['second dream warden addon'] = {cost = 0, items = {{22536,300}}, outfit_female = 578, outfit_male = 577, addon = 2, storageID = 10076},
    ['first glooth engineer addon'] = {cost = 0, items = {{23567,300}}, outfit_female = 618, outfit_male = 610, addon = 1, storageID = 10077},
    ['second glooth engineer addon'] = {cost = 0, items = {{23514,200}}, outfit_female = 618, outfit_male = 610, addon = 2, storageID = 10078},
    ['first champion addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 632, outfit_male = 633, addon = 1, storageID = 10079},
    ['second champion addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 632, outfit_male = 633, addon = 2, storageID = 10080},
    ['first conjurer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 635, outfit_male = 634, addon = 1, storageID = 10081},
    ['second conjurer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 635, outfit_male = 634, addon = 2, storageID = 10082},
    ['first beastmaster addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 636, outfit_male = 637, addon = 1, storageID = 10083},
    ['second beastmaster addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 636, outfit_male = 637, addon = 2, storageID = 10084},
    ['first chaos acolyt addon'] = {cost = 0, items = {{26191,200}}, outfit_female = 664, outfit_male = 665, addon = 1, storageID = 10085},
    ['second chaos acolyt addon'] = {cost = 0, items = {{26201,200}}, outfit_female = 664, outfit_male = 665, addon = 2, storageID = 10086},
    ['first death herald addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 666, outfit_male = 667, addon = 1, storageID = 10087},
    ['second death herald addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 666, outfit_male = 667, addon = 2, storageID = 10088},
    ['first ranger addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 683, outfit_male = 684, addon = 1, storageID = 10089},
    ['second ranger addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 683, outfit_male = 684, addon = 2, storageID = 10090},
    ['first ceremonial garb addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 694, outfit_male = 695, addon = 1, storageID = 10091},
    ['second ceremonial garb addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 694, outfit_male = 695, addon = 2, storageID = 10092},
    ['first puppeteer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 696, outfit_male = 697, addon = 1, storageID = 10093},
    ['second puppeteer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 696, outfit_male = 697, addon = 2, storageID = 10094},
    ['first spirit caller addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 698, outfit_male = 699, addon = 1, storageID = 10095},
    ['second spirit caller addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 698, outfit_male = 699, addon = 2, storageID = 10096},
    ['first evoker addon'] = {cost = 0, items = {{5894,300}}, outfit_female = 724, outfit_male = 725, addon = 1, storageID = 10097},
    ['second evoker addon'] = {cost = 0, items = {{5894,300}}, outfit_female = 724, outfit_male = 725, addon = 2, storageID = 10098},
    ['first seaweaver addon'] = {cost = 0, items = {{15430,300}}, outfit_female = 732, outfit_male = 733, addon = 1, storageID = 10099},
    ['second seaweaver addon'] = {cost = 0, items = {{13870,200}}, outfit_female = 732, outfit_male = 733, addon = 2, storageID = 10100},
    ['first recruiter addon'] = {cost = 0, items = {{6547,300}}, outfit_female = 745, outfit_male = 746, addon = 1, storageID = 10101},
    ['second recruiter addon'] = {cost = 0, items = {{6548,300}}, outfit_female = 745, outfit_male = 746, addon = 2, storageID = 10102},
    ['first sea dog addon'] = {cost = 0, items = {{11219,200}}, outfit_female = 749, outfit_male = 750, addon = 1, storageID = 10103},
    ['second sea dog addon'] = {cost = 0, items = {{6098,200}}, outfit_female = 749, outfit_male = 750, addon = 2, storageID = 10104},
    ['first royal pumpkin addon'] = {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 1, storageID = 10105},
    ['second royal pumpkin addon'] = {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 2, storageID = 10106},
    ['first rift warrior addon'] = {cost = 0, items = {{5954,800}}, outfit_female = 845, outfit_male = 846, addon = 1, storageID = 10107},
    ['second rift warrior addon'] = {cost = 0, items = {{5948,800}}, outfit_female = 845, outfit_male = 846, addon = 2, storageID = 10108},
    ['first winter warden addon'] = {cost = 0, items = {{10578,200}}, outfit_female = 852, outfit_male = 853, addon = 1, storageID = 10109},
    ['second winter warden addon'] = {cost = 0, items = {{2396,20}}, outfit_female = 852, outfit_male = 853, addon = 2, storageID = 10110},
    ['first philosopher addon'] = {cost = 0, items = {{20102,200}}, outfit_female = 874, outfit_male = 873, addon = 1, storageID = 10111},
    ['second philosopher addon'] = {cost = 0, items = {{20110,200}}, outfit_female = 874, outfit_male = 873, addon = 2, storageID = 10112},
    ['first arena champion addon'] = {cost = 0, items = {{18425,200}}, outfit_female = 884, outfit_male = 885, addon = 1, storageID = 10113},
    ['second arena champion addon'] = {cost = 0, items = {{3976,800}}, outfit_female = 884, outfit_male = 885, addon = 2, storageID = 10114},
    ['first lupine warden addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 1, storageID = 10115},
    ['second lupine warden addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 2, storageID = 10116},
    ['first grove keeper addon'] = {cost = 0, items = {{13533,100}}, outfit_female = 909, outfit_male = 908, addon = 1, storageID = 10117},
    ['second grove keeper addon'] = {cost = 0, items = {{13534,100}}, outfit_female = 909, outfit_male = 908, addon = 2, storageID = 10118},
    ['first pharao addon'] = {cost = 0, items = {{2348,20}}, outfit_female = 956, outfit_male = 955, addon = 1, storageID = 10129},
    ['second pharao addon'] = {cost = 0, items = {{2139,20}}, outfit_female = 956, outfit_male = 955, addon = 2, storageID = 10130},
    ['first festive addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 1, storageID = 10121},
    ['second festive addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 2, storageID = 10122},
    ['first trophy hunter addon'] = {cost = 0, items = {{12431,20}}, outfit_female = 958, outfit_male = 957, addon = 1, storageID = 10123},
    ['second trophy hunter addon'] = {cost = 0, items = {{5943,5}}, outfit_female = 958, outfit_male = 957, addon = 2, storageID = 10124},
    ['first herbalist addon'] = {cost = 0, items = {{29474,20}}, outfit_female = 1078, outfit_male = 1079, addon = 1, storageID = 10125},
    ['second herbalist addon'] = {cost = 0, items = {{29475,20}}, outfit_female = 1078, outfit_male = 1079, addon = 2, storageID = 10126},

    -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052 --
}

local o = {'citizen', 'hunter', 'knight', 'mage', 'nobleman', 'summoner', 'warrior', 'barbarian', 'druid', 'wizard', 'oriental', 'pirate', 'assassin', 'beggar',
'shaman', 'norseman', 'nightmare', 'jester', 'yalaharian', 'brotherhood', 'demonhunter', 'warmaster',
'wayfarer', 'afflicted', 'elementalist', 'deepling', 'insectoid', 'entrepreneur', 'crystal warlord', 'soil guardian', 'demon', 'cave explorer', 'dream warden',
'glooth engineer', 'champion', 'conjurer', 'beastmaster', 'chaos acolyt', 'death herald', 'ranger', 'ceremonial garb', 'puppeteer', 'spirit caller',
'evoker', 'seaweaver', 'recruiter', 'sea dog', 'royal pumpkin', 'rift warrior', 'winter warden', 'philosopher', 'arena champion', 'lupine warden', 'grove keeper',
'pharao', 'festive', 'trophy hunter', 'herbalist'}

function creatureSayCallback(cid, type, msg)
    local talkUser = cid
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    if addoninfo[msg] ~= nil then
        if (getPlayerStorageValue(cid, addoninfo[msg].storageID) ~= -1) then
            npcHandler:say('You already have this addon!', cid)
            npcHandler:resetNpc()
        else
            local itemsTable = addoninfo[msg].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] .. ' ' .. ItemType(item[1]):getName()
                            if i ~= table.maxn(itemsTable) then
                                    items_list = items_list .. ', '
                            end
                    end
            end
            local text = ''
            if (addoninfo[msg].cost > 0) then
                    text = addoninfo[msg].cost .. ' gp'
            elseif table.maxn(addoninfo[msg].items) then
                    text = items_list
            elseif (addoninfo[msg].cost > 0) and table.maxn(addoninfo[msg].items) then
                    text = items_list .. ' and ' .. addoninfo[msg].cost .. ' gp'
            end
            npcHandler:say('For ' .. msg .. ' you will need ' .. text .. '. Do you have it all with you?', cid)
            rtnt[talkUser] = msg
            talkState[talkUser] = 1
            return true
        end
    elseif msgcontains(msg, "yes") then
        if talkState[talkUser] == 1 then
            local items_number = 0
            if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then
                for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do
                    local item = addoninfo[rtnt[talkUser]].items[i]
                    if (getPlayerItemCount(cid,item[1]) >= item[2]) then
                        items_number = items_number + 1
                    end
                end
            end
            if(getPlayerMoney(cid) >= addoninfo[rtnt[talkUser]].cost) and (items_number == table.maxn(addoninfo[rtnt[talkUser]].items)) then
                doPlayerRemoveMoney(cid, addoninfo[rtnt[talkUser]].cost)
                if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then
                    for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do
                        local item = addoninfo[rtnt[talkUser]].items[i]
                        doPlayerRemoveItem(cid,item[1],item[2])
                    end
                end
                doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_male, addoninfo[rtnt[talkUser]].addon)
                doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_female, addoninfo[rtnt[talkUser]].addon)
                setPlayerStorageValue(cid,addoninfo[rtnt[talkUser]].storageID,1)
                npcHandler:say('Here you are.', cid)
            else
                npcHandler:say('You do not have needed items!', cid)
            end
            rtnt[talkUser] = nil
            talkState[talkUser] = 0
            npcHandler:resetNpc()
            return true
        end
    elseif msgcontains(msg, "addon") then
        npcHandler:say('I can give you addons for {' .. table.concat(o, "}, {") .. '} outfits.', cid)
        rtnt[talkUser] = nil
        talkState[talkUser] = 0
        npcHandler:resetNpc()
        return true
    elseif msgcontains(msg, "help") then
        npcHandler:say('To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.', cid)
        rtnt[talkUser] = nil
        talkState[talkUser] = 0
        npcHandler:resetNpc()
        return true
    else
        if talkState[talkUser] ~= nil then
            if talkState[talkUser] > 0 then
                npcHandler:say('Come back when you get these items.', cid)
                rtnt[talkUser] = nil
                talkState[talkUser] = 0
                npcHandler:resetNpc()
                return true
            end
        end
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Solution
Here is my suggested edit due to character count limit on boards of 25k letters.
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
local talkState = {}
local rtnt = {}

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|. I need your help and I'll reward you with nice addons if you help me! Just say {addons} or {help} if you don't know what to do.")

addoninfo = {
    ['first citizen addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10042},
    ['second citizen addon'] = {cost = 0, items = {{5890,50}, {5902,25}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10043},
    ['first hunter addon'] = {cost = 0, items = {{5876,50}, {5948,50}, {5891,5}, {5887,1}, {5889,1}, {5888,1}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 10044},
    ['second hunter addon'] = {cost = 0, items = {{5875,1}}, outfit_female = 137, outfit_male = 129, addon = 2, storageID = 10045},
    ['first knight addon'] = {cost = 0, items = {{5880,50}, {5892,1}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 10046},
    ['second knight addon'] = {cost = 0, items = {{5893,50}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10047},
    ['first mage addon'] = {cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {2392,30}, {5809,1}, {2193,20}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 10048},
    ['second mage addon'] = {cost = 0, items = {{5903,1}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 10049},
    ['first summoner addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 10050},
    ['second summoner addon'] = {cost = 0, items = {{5894,35}, {5911,20}, {5883,40}, {5922,35}, {5879,10}, {5881,30}, {5882,40}, {2392,3}, {5905,30}}, outfit_female = 141, outfit_male = 133, addon = 2, storageID = 10051},
    ['first barbarian addon'] = {cost = 0, items = {{5884,1}, {5885,1}, {5910,25}, {5911,25}, {5886,10}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011},
    ['second barbarian addon'] = {cost = 0, items = {{5880,25}, {5892,1}, {5893,25}, {5876,25}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012},
    ['first druid addon'] = {cost = 0, items = {{5896,20}, {5897,20}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013},
    ['second druid addon'] = {cost = 0, items = {{5906,100}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014},
    ['first nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015},
    ['second nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016},
    ['first oriental addon'] = {cost = 0, items = {{9020,5}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017},
    ['second oriental addon'] = {cost = 0, items = {{5883,30}, {5895,30}, {5891,2}, {5912,30}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018},
    ['first warrior addon'] = {cost = 0, items = {{5925,40}, {5899,40}, {5884,1}, {5919,1}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 10019},
    ['second warrior addon'] = {cost = 0, items = {{5880,40}, {5887,1}}, outfit_female = 142, outfit_male = 134, addon = 2, storageID = 10020},
    ['first wizard addon'] = {cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021},
    ['second wizard addon'] = {cost = 0, items = {{5922,40}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022},
    ['first assassin addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5913,20}, {5914,20}, {5909,20}, {5886,10}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023},
    ['second assassin addon'] = {cost = 0, items = {{5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024},
    ['first beggar addon'] = {cost = 0, items = {{5878,30}, {5921,20}, {5913,10}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025},
    ['second beggar addon'] = {cost = 0, items = {{5883,30}, {2160,2}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026},
    ['first pirate addon'] = {cost = 0, items = {{6098,30}, {6126,30}, {6097,30}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 10027},
    ['second pirate addon'] = {cost = 0, items = {{6101,1}, {6102,1}, {6100,1}, {6099,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028},
    ['first shaman addon'] = {cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029},
    ['second shaman addon'] = {cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030},
    ['first norseman addon'] = {cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031},
    ['second norseman addon'] = {cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032},
    ['first jester addon'] = {cost = 0, items = {{5912,20}, {5913,20}, {5914,20}, {5909,20}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 10033},
    ['second jester addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5912,20}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 10034},
    ['first demonhunter addon'] = {cost = 0, items = {{5905,30}, {5906,40}, {5954,20}, {6500,50}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 10035},
    ['second demonhunter addon'] = {cost = 0, items = {{5906,50}, {6500,200}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 10036},
    ['first nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037},
    ['second nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038},
    ['first brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 1, storageID = 10039},
    ['second brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040},
    ['first yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 10041},
    ['second yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 2, storageID = 10052},
    ['first warmaster addon'] = {cost = 0, items = {{11325,200}}, outfit_female = 336, outfit_male = 335, addon = 1, storageID = 10053},
    ['second warmaster addon'] = {cost = 0, items = {{11245,200}}, outfit_female = 336, outfit_male = 335, addon = 2, storageID = 10054},
    ['first wayfarer addon'] = {cost = 0, items = {{11334,300}}, outfit_female = 366, outfit_male = 367, addon = 1, storageID = 10055},
    ['second wayfarer addon'] = {cost = 0, items = {{10549,100}}, outfit_female = 366, outfit_male = 367, addon = 2, storageID = 10056},
    ['first afflicted addon'] = {cost = 0, items = {{13541,300}}, outfit_female = 431, outfit_male = 430, addon = 1, storageID = 10057},
    ['second afflicted addon'] = {cost = 0, items = {{13544,300}}, outfit_female = 431, outfit_male = 430, addon = 2, storageID = 10058},
    ['first elementalist addon'] = {cost = 0, items = {{13758,80}}, outfit_female = 433, outfit_male = 432, addon = 1, storageID = 10059},
    ['second elementalist addon'] = {cost = 0, items = {{8900,2}}, outfit_female = 433, outfit_male = 432, addon = 2, storageID = 10060},
    ['first deepling addon'] = {cost = 0, items = {{15411,1}}, outfit_female = 464, outfit_male = 463, addon = 1, storageID = 10061},
    ['second deepling addon'] = {cost = 0, items = {{15404,1}}, outfit_female = 464, outfit_male = 463, addon = 2, storageID = 10062},
    ['first insectoid addon'] = {cost = 0, items = {{16096,10}}, outfit_female = 466, outfit_male = 465, addon = 1, storageID = 10063},
    ['second insectoid addon'] = {cost = 0, items = {{15480,250}}, outfit_female = 466, outfit_male = 465, addon = 2, storageID = 10064},
    ['first entrepreneur addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 471, outfit_male = 472, addon = 1, storageID = 10065},
    ['second entrepreneur addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 471, outfit_male = 472, addon = 2, storageID = 10066},
    ['first crystal warlord addon'] = {cost = 0, items = {{18432,430}}, outfit_female = 513, outfit_male = 512, addon = 1, storageID = 10067},
    ['second crystal warlord addon'] = {cost = 0, items = {{18431,200}}, outfit_female = 513, outfit_male = 512, addon = 2, storageID = 10068},
    ['first soil guardian addon'] = {cost = 0, items = {{18433,350}}, outfit_female = 514, outfit_male = 516, addon = 1, storageID = 10069},
    ['second soil guardian addon'] = {cost = 0, items = {{18436,200}}, outfit_female = 514, outfit_male = 516, addon = 2, storageID = 10070},
    ['first demon addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 542, outfit_male = 541, addon = 1, storageID = 10071},
    ['second demon addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 542, outfit_male = 541, addon = 2, storageID = 10072},
    ['first cave explorer addon'] = {cost = 0, items = {{22541,200}}, outfit_female = 575, outfit_male = 574, addon = 1, storageID = 10073},
    ['second cave explorer addon'] = {cost = 0, items = {{22539,200}}, outfit_female = 575, outfit_male = 574, addon = 2, storageID = 10074},
    ['first dream warden addon'] = {cost = 0, items = {{22534,200}}, outfit_female = 578, outfit_male = 577, addon = 1, storageID = 10075},
    ['second dream warden addon'] = {cost = 0, items = {{22536,300}}, outfit_female = 578, outfit_male = 577, addon = 2, storageID = 10076},
    ['first glooth engineer addon'] = {cost = 0, items = {{23567,300}}, outfit_female = 618, outfit_male = 610, addon = 1, storageID = 10077},
    ['second glooth engineer addon'] = {cost = 0, items = {{23514,200}}, outfit_female = 618, outfit_male = 610, addon = 2, storageID = 10078},
    ['first champion addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 632, outfit_male = 633, addon = 1, storageID = 10079},
    ['second champion addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 632, outfit_male = 633, addon = 2, storageID = 10080},
    ['first conjurer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 635, outfit_male = 634, addon = 1, storageID = 10081},
    ['second conjurer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 635, outfit_male = 634, addon = 2, storageID = 10082},
    ['first beastmaster addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 636, outfit_male = 637, addon = 1, storageID = 10083},
    ['second beastmaster addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 636, outfit_male = 637, addon = 2, storageID = 10084},
    ['first chaos acolyt addon'] = {cost = 0, items = {{26191,200}}, outfit_female = 664, outfit_male = 665, addon = 1, storageID = 10085},
    ['second chaos acolyt addon'] = {cost = 0, items = {{26201,200}}, outfit_female = 664, outfit_male = 665, addon = 2, storageID = 10086},
    ['first death herald addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 666, outfit_male = 667, addon = 1, storageID = 10087},
    ['second death herald addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 666, outfit_male = 667, addon = 2, storageID = 10088},
    ['first ranger addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 683, outfit_male = 684, addon = 1, storageID = 10089},
    ['second ranger addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 683, outfit_male = 684, addon = 2, storageID = 10090},
    ['first ceremonial garb addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 694, outfit_male = 695, addon = 1, storageID = 10091},
    ['second ceremonial garb addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 694, outfit_male = 695, addon = 2, storageID = 10092},
    ['first puppeteer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 696, outfit_male = 697, addon = 1, storageID = 10093},
    ['second puppeteer addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 696, outfit_male = 697, addon = 2, storageID = 10094},
    ['first spirit caller addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 698, outfit_male = 699, addon = 1, storageID = 10095},
    ['second spirit caller addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 698, outfit_male = 699, addon = 2, storageID = 10096},
    ['first evoker addon'] = {cost = 0, items = {{5894,300}}, outfit_female = 724, outfit_male = 725, addon = 1, storageID = 10097},
    ['second evoker addon'] = {cost = 0, items = {{5894,300}}, outfit_female = 724, outfit_male = 725, addon = 2, storageID = 10098},
    ['first seaweaver addon'] = {cost = 0, items = {{15430,300}}, outfit_female = 732, outfit_male = 733, addon = 1, storageID = 10099},
    ['second seaweaver addon'] = {cost = 0, items = {{13870,200}}, outfit_female = 732, outfit_male = 733, addon = 2, storageID = 10100},
    ['first recruiter addon'] = {cost = 0, items = {{6547,300}}, outfit_female = 745, outfit_male = 746, addon = 1, storageID = 10101},
    ['second recruiter addon'] = {cost = 0, items = {{6548,300}}, outfit_female = 745, outfit_male = 746, addon = 2, storageID = 10102},
    ['first sea dog addon'] = {cost = 0, items = {{11219,200}}, outfit_female = 749, outfit_male = 750, addon = 1, storageID = 10103},
    ['second sea dog addon'] = {cost = 0, items = {{6098,200}}, outfit_female = 749, outfit_male = 750, addon = 2, storageID = 10104},
    ['first royal pumpkin addon'] = {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 1, storageID = 10105},
    ['second royal pumpkin addon'] = {cost = 0, items = {{2683,100}}, outfit_female = 759, outfit_male = 760, addon = 2, storageID = 10106},
    ['first rift warrior addon'] = {cost = 0, items = {{5954,800}}, outfit_female = 845, outfit_male = 846, addon = 1, storageID = 10107},
    ['second rift warrior addon'] = {cost = 0, items = {{5948,800}}, outfit_female = 845, outfit_male = 846, addon = 2, storageID = 10108},
    ['first winter warden addon'] = {cost = 0, items = {{10578,200}}, outfit_female = 852, outfit_male = 853, addon = 1, storageID = 10109},
    ['second winter warden addon'] = {cost = 0, items = {{2396,20}}, outfit_female = 852, outfit_male = 853, addon = 2, storageID = 10110},
    ['first philosopher addon'] = {cost = 0, items = {{20102,200}}, outfit_female = 874, outfit_male = 873, addon = 1, storageID = 10111},
    ['second philosopher addon'] = {cost = 0, items = {{20110,200}}, outfit_female = 874, outfit_male = 873, addon = 2, storageID = 10112},
    ['first arena champion addon'] = {cost = 0, items = {{18425,200}}, outfit_female = 884, outfit_male = 885, addon = 1, storageID = 10113},
    ['second arena champion addon'] = {cost = 0, items = {{3976,800}}, outfit_female = 884, outfit_male = 885, addon = 2, storageID = 10114},
    ['first lupine warden addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 1, storageID = 10115},
    ['second lupine warden addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 900, outfit_male = 899, addon = 2, storageID = 10116},
    ['first grove keeper addon'] = {cost = 0, items = {{13533,100}}, outfit_female = 909, outfit_male = 908, addon = 1, storageID = 10117},
    ['second grove keeper addon'] = {cost = 0, items = {{13534,100}}, outfit_female = 909, outfit_male = 908, addon = 2, storageID = 10118},
    ['first pharao addon'] = {cost = 0, items = {{2348,20}}, outfit_female = 956, outfit_male = 955, addon = 1, storageID = 10129},
    ['second pharao addon'] = {cost = 0, items = {{2139,20}}, outfit_female = 956, outfit_male = 955, addon = 2, storageID = 10130},
    ['first festive addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 1, storageID = 10121},
    ['second festive addon'] = {cost = 0, items = {{18422,20}}, outfit_female = 929, outfit_male = 931, addon = 2, storageID = 10122},
    ['first trophy hunter addon'] = {cost = 0, items = {{12431,20}}, outfit_female = 958, outfit_male = 957, addon = 1, storageID = 10123},
    ['second trophy hunter addon'] = {cost = 0, items = {{5943,5}}, outfit_female = 958, outfit_male = 957, addon = 2, storageID = 10124},
    ['first herbalist addon'] = {cost = 0, items = {{29474,20}}, outfit_female = 1078, outfit_male = 1079, addon = 1, storageID = 10125},
    ['second herbalist addon'] = {cost = 0, items = {{29475,20}}, outfit_female = 1078, outfit_male = 1079, addon = 2, storageID = 10126},

    -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052   -- next storage 10052 --
}

local o = {'citizen', 'hunter', 'knight', 'mage', 'nobleman', 'summoner', 'warrior', 'barbarian', 'druid', 'wizard', 'oriental', 'pirate', 'assassin', 'beggar',
'shaman', 'norseman', 'nightmare', 'jester', 'yalaharian', 'brotherhood', 'demonhunter', 'warmaster',
'wayfarer', 'afflicted', 'elementalist', 'deepling', 'insectoid', 'entrepreneur', 'crystal warlord', 'soil guardian', 'demon', 'cave explorer', 'dream warden',
'glooth engineer', 'champion', 'conjurer', 'beastmaster', 'chaos acolyt', 'death herald', 'ranger', 'ceremonial garb', 'puppeteer', 'spirit caller',
'evoker', 'seaweaver', 'recruiter', 'sea dog', 'royal pumpkin', 'rift warrior', 'winter warden', 'philosopher', 'arena champion', 'lupine warden', 'grove keeper',
'pharao', 'festive', 'trophy hunter', 'herbalist'}

function creatureSayCallback(cid, type, msg)
    local talkUser = cid
    if(not npcHandler:isFocused(cid)) then
        return false
    end
    if addoninfo[msg] ~= nil then
        if (getPlayerStorageValue(cid, addoninfo[msg].storageID) ~= -1) then
            npcHandler:say('You already have this addon!', cid)
            npcHandler:resetNpc()
        else
            local itemsTable = addoninfo[msg].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] .. ' ' .. ItemType(item[1]):getName()
                            if i ~= table.maxn(itemsTable) then
                                    items_list = items_list .. ', '
                            end
                    end
            end
            local text = ''
            if (addoninfo[msg].cost > 0) then
                    text = addoninfo[msg].cost .. ' gp'
            elseif table.maxn(addoninfo[msg].items) then
                    text = items_list
            elseif (addoninfo[msg].cost > 0) and table.maxn(addoninfo[msg].items) then
                    text = items_list .. ' and ' .. addoninfo[msg].cost .. ' gp'
            end
            npcHandler:say('For ' .. msg .. ' you will need ' .. text .. '. Do you have it all with you?', cid)
            rtnt[talkUser] = msg
            talkState[talkUser] = 1
            return true
        end
    elseif msgcontains(msg, "yes") then
        if talkState[talkUser] == 1 then
            local items_number = 0
            if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then
                for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do
                    local item = addoninfo[rtnt[talkUser]].items[i]
                    if (getPlayerItemCount(cid,item[1]) >= item[2]) then
                        items_number = items_number + 1
                    end
                end
            end
            if(getPlayerMoney(cid) >= addoninfo[rtnt[talkUser]].cost) and (items_number == table.maxn(addoninfo[rtnt[talkUser]].items)) then
                doPlayerRemoveMoney(cid, addoninfo[rtnt[talkUser]].cost)
                if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then
                    for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do
                        local item = addoninfo[rtnt[talkUser]].items[i]
                        doPlayerRemoveItem(cid,item[1],item[2])
                    end
                end
                doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_male, addoninfo[rtnt[talkUser]].addon)
                doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_female, addoninfo[rtnt[talkUser]].addon)
                setPlayerStorageValue(cid,addoninfo[rtnt[talkUser]].storageID,1)
                npcHandler:say('Here you are.', cid)
            else
                npcHandler:say('You do not have needed items!', cid)
            end
            rtnt[talkUser] = nil
            talkState[talkUser] = 0
            npcHandler:resetNpc()
            return true
        end
    elseif msgcontains(msg, "addon") then
        npcHandler:say('I can give you addons for {' .. table.concat(o, "}, {") .. '} outfits.', cid)
        rtnt[talkUser] = nil
        talkState[talkUser] = 0
        npcHandler:resetNpc()
        return true
    elseif msgcontains(msg, "help") then
        npcHandler:say('To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.', cid)
        rtnt[talkUser] = nil
        talkState[talkUser] = 0
        npcHandler:resetNpc()
        return true
    else
        if talkState[talkUser] ~= nil then
            if talkState[talkUser] > 0 then
                npcHandler:say('Come back when you get these items.', cid)
                rtnt[talkUser] = nil
                talkState[talkUser] = 0
                npcHandler:resetNpc()
                return true
            end
        end
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


thanks man!! altho a little problem, im using your edited version and now i said:
-first pharao outfit
-You dont have the items (and it took all items)
then i tried again
-first pharao aoutfit
-Here you are (and didnt took items)
 
thanks man!! altho a little problem, im using your edited version and now i said:
-first pharao outfit
-You dont have the items (and it took all items)
then i tried again
-first pharao aoutfit
-Here you are (and didnt took items)
Try with a new character after restarting server and post the chat from npc?
I don't see how that's possible, unless you reloaded npc's after having your talkstate set at some point.
 
Try with a new character after restarting server and post the chat from npc?
I don't see how that's possible, unless you reloaded npc's after having your talkstate set at some point.
what i did is replace your edit for my script, reload npc and tried, now i copied it again just in case, reloaded npcs and said

Code:
19:51 Motivado: second pharao addon
19:51 Varkhal: For second pharao addon you will need 20 ancient tiara. Do you have it all with you?
19:51 Motivado: yes
19:51 Varkhal: Here you are.

but didnt take my items, i'll try again after reloading the server, thanks man!
 
what i did is replace your edit for my script, reload npc and tried, now i copied it again just in case, reloaded npcs and said

Code:
19:51 Motivado: second pharao addon
19:51 Varkhal: For second pharao addon you will need 20 ancient tiara. Do you have it all with you?
19:51 Motivado: yes
19:51 Varkhal: Here you are.

but didnt take my items, i'll try again after reloading the server, thanks man!
Idk, I've looked over the code like 14 times, and can't fathom how it's possible for it to not take the items.
 
Idk, I've looked over the code like 14 times, and can't fathom how it's possible for it to not take the items.
ooohhh it took them!!! the thing is i was looking at the backpack with all the items and i didnt see them dissapear, but just now i closed and opened the backpack again and it was empty! so weird!
 
Back
Top