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

Lua Why does this script does not work?

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
Script part
LUA:
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
        elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 1 then
		selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
		Topic[cid] = 1
		if Topic[cid] == 1 and msgcontains(msg, "yes") then
        		if (getPlayerItemCount(cid,5809) >= 1) and (getPlayerItemCount(cid,2193) >= 20) and (getPlayerItemCount(cid,5904) >= 10) and (getPlayerItemCount(cid,2182) >= 1) and (getPlayerItemCount(cid,2186) >= 1) and (getPlayerItemCount(cid,2185) >= 1) and (getPlayerItemCount(cid,2181) >= 1) and (getPlayerItemCount(cid,2183) >= 1) and (getPlayerItemCount(cid,2190) >= 1) and (getPlayerItemCount(cid,2191) >= 1) and (getPlayerItemCount(cid,2188) >= 1) and (getPlayerItemCount(cid,2189) >= 1) and (getPlayerItemCount(cid,2187) >= 1) then
				if getPlayerStorageValue(cid, 10006) <= 0 then
					doPlayerRemoveItem(cid, 5809, 1) 
					doPlayerRemoveItem(cid, 2193, 20) 
					doPlayerRemoveItem(cid, 5904, 10) 
					doPlayerRemoveItem(cid, 2182, 1) 
					doPlayerRemoveItem(cid, 2186, 1) 
					doPlayerRemoveItem(cid, 2185, 1) 
					doPlayerRemoveItem(cid, 2181, 1) 
					doPlayerRemoveItem(cid, 2183, 1) 
					doPlayerRemoveItem(cid, 2190, 1) 
					doPlayerRemoveItem(cid, 2191, 1) 
					doPlayerRemoveItem(cid, 2188, 1) 
					doPlayerRemoveItem(cid, 2189, 1)
					doPlayerRemoveItem(cid, 2187, 1)
					doPlayerAddOutfit(cid, 130, 1)
					local pos = getCreaturePosition(cid)
					doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
				else
					selfSay('You already have this addon', cid)
				end
			else
				selfSay('You do not have the required item', cid)
			end
		end
        elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 0 then
		selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
		Topic[cid] = 1
		if Topic[cid] == 1 and msgcontains(msg, "yes") then
				if (getPlayerItemCount(cid,5958) >= 1) then
					if getPlayerStorageValue(cid, 10006) <= 0 then
						doPlayerRemoveItem(cid, 5958, 1) 
						doPlayerAddOutfit(cid, 138, 1)
						local pos = getCreaturePosition(cid)
						doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
					else
						selfSay('You already have this addon', cid)
					end
				else
					selfSay('You do not have the required itens', cid)
				end
		elseif msgcontains(msg, "no") then
				selfSay('Alright then. Come back when you got the neccessary items.', cid)
		end
	end
end

Me: first mage addon
NPC: Do you want first mage addon for 1 ferumbras' hat?
Me: Yes or No
-- NOTHING HAPPENS --
 
Last edited:
Sem título.jpg

LUA:
--Made by LucasOlzon
 
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
 
-- START -- 
function citizen1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5878) >= 100) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5878, 100) 
				doPlayerAddOutfit(cid, 128, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
	else
		if (getPlayerItemCount(cid,5878) >= 100) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5878, 100) 
				doPlayerAddOutfit(cid, 136, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function citizen2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5890) >= 100) and (getPlayerItemCount(cid,5902) >= 50) and (getPlayerItemCount(cid,2480) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5890, 100) 
				doPlayerRemoveItem(cid, 5902, 50) 
				doPlayerRemoveItem(cid, 2480, 1) 
				doPlayerAddOutfit(cid, 128, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5890) >= 100) and (getPlayerItemCount(cid,5902) >= 50) and (getPlayerItemCount(cid,2480) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5890, 100) 
				doPlayerRemoveItem(cid, 5902, 50) 
				doPlayerRemoveItem(cid, 2480, 1) 
				doPlayerAddOutfit(cid, 136, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function hunter1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5876) >= 100) and (getPlayerItemCount(cid,5948) >= 100) and (getPlayerItemCount(cid,5891) >= 5) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,5888) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5947, 1) 
				doPlayerRemoveItem(cid, 5876, 100) 
				doPlayerRemoveItem(cid, 5948, 100) 
				doPlayerRemoveItem(cid, 5891, 5) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerRemoveItem(cid, 5889, 1) 
				doPlayerRemoveItem(cid, 5888, 1) 
				doPlayerAddOutfit(cid, 129, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5876) >= 100) and (getPlayerItemCount(cid,5948) >= 100) and (getPlayerItemCount(cid,5891) >= 5) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,5888) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5947, 1) 
				doPlayerRemoveItem(cid, 5876, 100) 
				doPlayerRemoveItem(cid, 5948, 100) 
				doPlayerRemoveItem(cid, 5891, 5) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerRemoveItem(cid, 5889, 1) 
				doPlayerRemoveItem(cid, 5888, 1) 
				doPlayerAddOutfit(cid, 137, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function hunter2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if getPlayerItemCount(cid,5875) >= 1 then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5875, 1) 
				doPlayerAddOutfit(cid, 129, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if getPlayerItemCount(cid,5875) >= 1 then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5875, 1) 
				doPlayerAddOutfit(cid, 137, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
--Mage Outfit
local Topic = {}
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
			elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 1 then
				selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
				Topic[cid] = 1
					elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 1 then
						if (getPlayerItemCount(cid,5809) >= 1) and (getPlayerItemCount(cid,2193) >= 20) and (getPlayerItemCount(cid,5904) >= 10) and (getPlayerItemCount(cid,2182) >= 1) and (getPlayerItemCount(cid,2186) >= 1) and (getPlayerItemCount(cid,2185) >= 1) and (getPlayerItemCount(cid,2181) >= 1) and (getPlayerItemCount(cid,2183) >= 1) and (getPlayerItemCount(cid,2190) >= 1) and (getPlayerItemCount(cid,2191) >= 1) and (getPlayerItemCount(cid,2188) >= 1) and (getPlayerItemCount(cid,2189) >= 1) and (getPlayerItemCount(cid,2187) >= 1) then
							if getPlayerStorageValue(cid, 10006) <= 0 then
								doPlayerRemoveItem(cid, 5809, 1) 
								doPlayerRemoveItem(cid, 2193, 20) 
								doPlayerRemoveItem(cid, 5904, 10) 
								doPlayerRemoveItem(cid, 2182, 1) 
								doPlayerRemoveItem(cid, 2186, 1) 
								doPlayerRemoveItem(cid, 2185, 1) 
								doPlayerRemoveItem(cid, 2181, 1) 
								doPlayerRemoveItem(cid, 2183, 1) 
								doPlayerRemoveItem(cid, 2190, 1) 
								doPlayerRemoveItem(cid, 2191, 1) 
								doPlayerRemoveItem(cid, 2188, 1) 
								doPlayerRemoveItem(cid, 2189, 1)
								doPlayerRemoveItem(cid, 2187, 1)
								doPlayerAddOutfit(cid, 130, 1)
								local pos = getCreaturePosition(cid)
								doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
							else
								selfSay('You already have this addon', cid)
							end
						else
							selfSay('You do not have the required item', cid)
						end
					elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 0 then
						selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
						Topic[cid] = 1
							elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 0 then
								if (getPlayerItemCount(cid,5958) >= 1) then
									if getPlayerStorageValue(cid, 10006) <= 0 then
										doPlayerRemoveItem(cid, 5958, 1) 
										doPlayerAddOutfit(cid, 138, 1)
										local pos = getCreaturePosition(cid)
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
									else
										selfSay('You already have this addon', cid)
									end
								else
									selfSay('You do not have the required itens', cid)
								end
							elseif msgcontains(msg, "no") then
								selfSay('Alright then. Come back when you got the neccessary items.', cid)
							end
					elseif msgcontains(msg, "second mage addon") and getPlayerSex(cid) == 1 then
						selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
						Topic[cid] = 1
							elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 1 then
								if (getPlayerItemCount(cid,5903) >= 1) then
									if getPlayerStorageValue(cid, 10006) <= 0 then
										doPlayerRemoveItem(cid, 5903, 1) 
										doPlayerAddOutfit(cid, 130, 2)
										local pos = getCreaturePosition(cid)
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
									else
										selfSay('You already have this addon', cid)
									end
								else
									selfSay('You do not have the required item', cid)
								end
							end
						elseif msgcontains(msg, "second mage addon") and getPlayerSex(cid) == 0 then
							selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
							Topic[cid] = 1
								elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 0 then
									if (getPlayerItemCount(cid,5894) >= 70) and (getPlayerItemCount(cid,5911) >= 20) and (getPlayerItemCount(cid,5883) >= 40) and (getPlayerItemCount(cid,5922) >= 35) and (getPlayerItemCount(cid,5886) >= 10) and (getPlayerItemCount(cid,5881) >= 60) and (getPlayerItemCount(cid,5882) >= 40) and (getPlayerItemCount(cid,5904) >= 15) and (getPlayerItemCount(cid,5905) >= 30) then
										if getPlayerStorageValue(cid, 10006) <= 0 then
											doPlayerRemoveItem(cid, 5894, 70) 
											doPlayerRemoveItem(cid, 5911, 20) 
											doPlayerRemoveItem(cid, 5883, 40) 
											doPlayerRemoveItem(cid, 5922, 35) 
											doPlayerRemoveItem(cid, 5886, 10) 
											doPlayerRemoveItem(cid, 5881, 60) 
											doPlayerRemoveItem(cid, 5882, 40) 
											doPlayerRemoveItem(cid, 5904, 15) 
											doPlayerRemoveItem(cid, 5905, 30) 
											doPlayerAddOutfit(cid, 138, 2)
											local pos = getCreaturePosition(cid)
											doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
										else
											selfSay('You already have this addon', cid)
										end
									else
										selfSay('You do not have the required itens', cid)
									end
								elseif msgcontains(msg, "no") then
									selfSay('Alright then. Come back when you got the neccessary items.', cid)
								end
						end
					end
				end
 
function knight1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5880) >= 100) and (getPlayerItemCount(cid,5892) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5880, 100) 
				doPlayerRemoveItem(cid, 5892, 1) 
				doPlayerAddOutfit(cid, 131, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5880) >= 100) and (getPlayerItemCount(cid,5892) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5880, 100) 
				doPlayerRemoveItem(cid, 5892, 1) 
				doPlayerAddOutfit(cid, 139, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
 
function knight2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5893) >= 100) and (getPlayerItemCount(cid,5924) >= 1) and (getPlayerItemCount(cid,5885) >= 1) and (getPlayerItemCount(cid,5887) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5893, 100) 
				doPlayerRemoveItem(cid, 5924, 1) 
				doPlayerRemoveItem(cid, 5885, 1) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerAddOutfit(cid, 131, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5893) >= 100) and (getPlayerItemCount(cid,5924) >= 1) and (getPlayerItemCount(cid,5885) >= 1) and (getPlayerItemCount(cid,5887) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5893, 100) 
				doPlayerRemoveItem(cid, 5924, 1) 
				doPlayerRemoveItem(cid, 5885, 1) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerAddOutfit(cid, 139, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function nobleman1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 132, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 140, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function nobleman2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 132, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 140, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
-- END --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can give you {citizen}, {hunter}, {mage}, {knight}, {nobleman}, {summoner}, {warrior}, {barbarian}, {druid}, {wizard}, {oriental}, {pirate}, {assassin}, {beggar}, {shaman}, {norseman}, {nighmare}, {jester}, {brotherhood}, {demonhunter}, {yalaharian}, {warmaster} and {wayfarer} addons."})
 
local node1 = keywordHandler:addKeyword({'first citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {first citizen addon} for 100 minotaur leathers?'})
node1:addChildKeyword({'yes'}, citizen1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node2 = keywordHandler:addKeyword({'second citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {second citizen addon} for 100 chicken feathers, 50 honeycombs and 1 legion helmet?'})
node2:addChildKeyword({'yes'}, citizen2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node3 = keywordHandler:addKeyword({'first hunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {first hunter addon} for 1 elane\'s crossbow, 100 lizard leather, 100 red dragon leather, 5 enchanted chicken wing, 1 piece of royal steel, 1 piece of draconian steel and 1 piece of hell steel?'})
node3:addChildKeyword({'yes'}, hunter1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node4 = keywordHandler:addKeyword({'second hunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {second hunter addon} for 1 sniper gloves?'})
node4:addChildKeyword({'yes'}, hunter2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Ehm, your script is quite a mess.

The NPC's say callback is pointed to your mage outfits, while you have functions for other outfits which never gets called?
 
Can you fix/optimize my script? (make it better)
LUA:
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
 
-- START -- 
function citizen1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5878) >= 100) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5878, 100) 
				doPlayerAddOutfit(cid, 128, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
	else
		if (getPlayerItemCount(cid,5878) >= 100) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5878, 100) 
				doPlayerAddOutfit(cid, 136, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function citizen2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5890) >= 100) and (getPlayerItemCount(cid,5902) >= 50) and (getPlayerItemCount(cid,2480) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5890, 100) 
				doPlayerRemoveItem(cid, 5902, 50) 
				doPlayerRemoveItem(cid, 2480, 1) 
				doPlayerAddOutfit(cid, 128, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5890) >= 100) and (getPlayerItemCount(cid,5902) >= 50) and (getPlayerItemCount(cid,2480) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5890, 100) 
				doPlayerRemoveItem(cid, 5902, 50) 
				doPlayerRemoveItem(cid, 2480, 1) 
				doPlayerAddOutfit(cid, 136, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function hunter1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5876) >= 100) and (getPlayerItemCount(cid,5948) >= 100) and (getPlayerItemCount(cid,5891) >= 5) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,5888) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5947, 1) 
				doPlayerRemoveItem(cid, 5876, 100) 
				doPlayerRemoveItem(cid, 5948, 100) 
				doPlayerRemoveItem(cid, 5891, 5) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerRemoveItem(cid, 5889, 1) 
				doPlayerRemoveItem(cid, 5888, 1) 
				doPlayerAddOutfit(cid, 129, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5876) >= 100) and (getPlayerItemCount(cid,5948) >= 100) and (getPlayerItemCount(cid,5891) >= 5) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,5888) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5947, 1) 
				doPlayerRemoveItem(cid, 5876, 100) 
				doPlayerRemoveItem(cid, 5948, 100) 
				doPlayerRemoveItem(cid, 5891, 5) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerRemoveItem(cid, 5889, 1) 
				doPlayerRemoveItem(cid, 5888, 1) 
				doPlayerAddOutfit(cid, 137, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function hunter2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if getPlayerItemCount(cid,5875) >= 1 then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5875, 1) 
				doPlayerAddOutfit(cid, 129, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if getPlayerItemCount(cid,5875) >= 1 then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5875, 1) 
				doPlayerAddOutfit(cid, 137, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
--Mage Outfit
local Topic = {}
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
			elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 1 then
				selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
				Topic[cid] = 1
					elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 1 then
						if (getPlayerItemCount(cid,5809) >= 1) and (getPlayerItemCount(cid,2193) >= 20) and (getPlayerItemCount(cid,5904) >= 10) and (getPlayerItemCount(cid,2182) >= 1) and (getPlayerItemCount(cid,2186) >= 1) and (getPlayerItemCount(cid,2185) >= 1) and (getPlayerItemCount(cid,2181) >= 1) and (getPlayerItemCount(cid,2183) >= 1) and (getPlayerItemCount(cid,2190) >= 1) and (getPlayerItemCount(cid,2191) >= 1) and (getPlayerItemCount(cid,2188) >= 1) and (getPlayerItemCount(cid,2189) >= 1) and (getPlayerItemCount(cid,2187) >= 1) then
							if getPlayerStorageValue(cid, 10006) <= 0 then
								doPlayerRemoveItem(cid, 5809, 1) 
								doPlayerRemoveItem(cid, 2193, 20) 
								doPlayerRemoveItem(cid, 5904, 10) 
								doPlayerRemoveItem(cid, 2182, 1) 
								doPlayerRemoveItem(cid, 2186, 1) 
								doPlayerRemoveItem(cid, 2185, 1) 
								doPlayerRemoveItem(cid, 2181, 1) 
								doPlayerRemoveItem(cid, 2183, 1) 
								doPlayerRemoveItem(cid, 2190, 1) 
								doPlayerRemoveItem(cid, 2191, 1) 
								doPlayerRemoveItem(cid, 2188, 1) 
								doPlayerRemoveItem(cid, 2189, 1)
								doPlayerRemoveItem(cid, 2187, 1)
								doPlayerAddOutfit(cid, 130, 1)
								local pos = getCreaturePosition(cid)
								doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
							else
								selfSay('You already have this addon', cid)
							end
						else
							selfSay('You do not have the required item', cid)
						end
					elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 0 then
						selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
						Topic[cid] = 1
							elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 0 then
								if (getPlayerItemCount(cid,5958) >= 1) then
									if getPlayerStorageValue(cid, 10006) <= 0 then
										doPlayerRemoveItem(cid, 5958, 1) 
										doPlayerAddOutfit(cid, 138, 1)
										local pos = getCreaturePosition(cid)
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
									else
										selfSay('You already have this addon', cid)
									end
								else
									selfSay('You do not have the required itens', cid)
								end
							elseif msgcontains(msg, "no") then
								selfSay('Alright then. Come back when you got the neccessary items.', cid)
							end
					elseif msgcontains(msg, "second mage addon") and getPlayerSex(cid) == 1 then
						selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
						Topic[cid] = 1
							elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 1 then
								if (getPlayerItemCount(cid,5903) >= 1) then
									if getPlayerStorageValue(cid, 10006) <= 0 then
										doPlayerRemoveItem(cid, 5903, 1) 
										doPlayerAddOutfit(cid, 130, 2)
										local pos = getCreaturePosition(cid)
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
									else
										selfSay('You already have this addon', cid)
									end
								else
									selfSay('You do not have the required item', cid)
								end
							end
						elseif msgcontains(msg, "second mage addon") and getPlayerSex(cid) == 0 then
							selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
							Topic[cid] = 1
								elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 0 then
									if (getPlayerItemCount(cid,5894) >= 70) and (getPlayerItemCount(cid,5911) >= 20) and (getPlayerItemCount(cid,5883) >= 40) and (getPlayerItemCount(cid,5922) >= 35) and (getPlayerItemCount(cid,5886) >= 10) and (getPlayerItemCount(cid,5881) >= 60) and (getPlayerItemCount(cid,5882) >= 40) and (getPlayerItemCount(cid,5904) >= 15) and (getPlayerItemCount(cid,5905) >= 30) then
										if getPlayerStorageValue(cid, 10006) <= 0 then
											doPlayerRemoveItem(cid, 5894, 70) 
											doPlayerRemoveItem(cid, 5911, 20) 
											doPlayerRemoveItem(cid, 5883, 40) 
											doPlayerRemoveItem(cid, 5922, 35) 
											doPlayerRemoveItem(cid, 5886, 10) 
											doPlayerRemoveItem(cid, 5881, 60) 
											doPlayerRemoveItem(cid, 5882, 40) 
											doPlayerRemoveItem(cid, 5904, 15) 
											doPlayerRemoveItem(cid, 5905, 30) 
											doPlayerAddOutfit(cid, 138, 2)
											local pos = getCreaturePosition(cid)
											doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
										else
											selfSay('You already have this addon', cid)
										end
									else
										selfSay('You do not have the required itens', cid)
									end
								elseif msgcontains(msg, "no") then
									selfSay('Alright then. Come back when you got the neccessary items.', cid)
								end
						end
					end
				end
 
function knight1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5880) >= 100) and (getPlayerItemCount(cid,5892) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5880, 100) 
				doPlayerRemoveItem(cid, 5892, 1) 
				doPlayerAddOutfit(cid, 131, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5880) >= 100) and (getPlayerItemCount(cid,5892) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5880, 100) 
				doPlayerRemoveItem(cid, 5892, 1) 
				doPlayerAddOutfit(cid, 139, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
 
function knight2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5893) >= 100) and (getPlayerItemCount(cid,5924) >= 1) and (getPlayerItemCount(cid,5885) >= 1) and (getPlayerItemCount(cid,5887) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5893, 100) 
				doPlayerRemoveItem(cid, 5924, 1) 
				doPlayerRemoveItem(cid, 5885, 1) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerAddOutfit(cid, 131, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5893) >= 100) and (getPlayerItemCount(cid,5924) >= 1) and (getPlayerItemCount(cid,5885) >= 1) and (getPlayerItemCount(cid,5887) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5893, 100) 
				doPlayerRemoveItem(cid, 5924, 1) 
				doPlayerRemoveItem(cid, 5885, 1) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerAddOutfit(cid, 139, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function nobleman1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 132, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 140, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function nobleman2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 132, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 140, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
-- END --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can give you {citizen}, {hunter}, {mage}, {knight}, {nobleman}, {summoner}, {warrior}, {barbarian}, {druid}, {wizard}, {oriental}, {pirate}, {assassin}, {beggar}, {shaman}, {norseman}, {nighmare}, {jester}, {brotherhood}, {demonhunter}, {yalaharian}, {warmaster} and {wayfarer} addons."})
 
local node1 = keywordHandler:addKeyword({'first citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {first citizen addon} for 100 minotaur leathers?'})
node1:addChildKeyword({'yes'}, citizen1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node2 = keywordHandler:addKeyword({'second citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {second citizen addon} for 100 chicken feathers, 50 honeycombs and 1 legion helmet?'})
node2:addChildKeyword({'yes'}, citizen2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node3 = keywordHandler:addKeyword({'first hunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {first hunter addon} for 1 elane\'s crossbow, 100 lizard leather, 100 red dragon leather, 5 enchanted chicken wing, 1 piece of royal steel, 1 piece of draconian steel and 1 piece of hell steel?'})
node3:addChildKeyword({'yes'}, hunter1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node4 = keywordHandler:addKeyword({'second hunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {second hunter addon} for 1 sniper gloves?'})
node4:addChildKeyword({'yes'}, hunter2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

i can pay for that
 
Last edited:
try
LUA:
--Made by LucasOlzon
 
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
 
-- START -- 
function citizen1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5878) >= 100) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5878, 100) 
				doPlayerAddOutfit(cid, 128, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
	else
		if (getPlayerItemCount(cid,5878) >= 100) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5878, 100) 
				doPlayerAddOutfit(cid, 136, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function citizen2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5890) >= 100) and (getPlayerItemCount(cid,5902) >= 50) and (getPlayerItemCount(cid,2480) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5890, 100) 
				doPlayerRemoveItem(cid, 5902, 50) 
				doPlayerRemoveItem(cid, 2480, 1) 
				doPlayerAddOutfit(cid, 128, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5890) >= 100) and (getPlayerItemCount(cid,5902) >= 50) and (getPlayerItemCount(cid,2480) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5890, 100) 
				doPlayerRemoveItem(cid, 5902, 50) 
				doPlayerRemoveItem(cid, 2480, 1) 
				doPlayerAddOutfit(cid, 136, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function hunter1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5876) >= 100) and (getPlayerItemCount(cid,5948) >= 100) and (getPlayerItemCount(cid,5891) >= 5) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,5888) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5947, 1) 
				doPlayerRemoveItem(cid, 5876, 100) 
				doPlayerRemoveItem(cid, 5948, 100) 
				doPlayerRemoveItem(cid, 5891, 5) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerRemoveItem(cid, 5889, 1) 
				doPlayerRemoveItem(cid, 5888, 1) 
				doPlayerAddOutfit(cid, 129, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5947) >= 1) and (getPlayerItemCount(cid,5876) >= 100) and (getPlayerItemCount(cid,5948) >= 100) and (getPlayerItemCount(cid,5891) >= 5) and (getPlayerItemCount(cid,5887) >= 1) and (getPlayerItemCount(cid,5889) >= 1) and (getPlayerItemCount(cid,5888) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5947, 1) 
				doPlayerRemoveItem(cid, 5876, 100) 
				doPlayerRemoveItem(cid, 5948, 100) 
				doPlayerRemoveItem(cid, 5891, 5) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerRemoveItem(cid, 5889, 1) 
				doPlayerRemoveItem(cid, 5888, 1) 
				doPlayerAddOutfit(cid, 137, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function hunter2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if getPlayerItemCount(cid,5875) >= 1 then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5875, 1) 
				doPlayerAddOutfit(cid, 129, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if getPlayerItemCount(cid,5875) >= 1 then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5875, 1) 
				doPlayerAddOutfit(cid, 137, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
--Mage Outfit
local Topic = {}
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
			elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 1 then
				selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
				Topic[cid] = 1
					elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 1 then
						if (getPlayerItemCount(cid,5809) >= 1) and (getPlayerItemCount(cid,2193) >= 20) and (getPlayerItemCount(cid,5904) >= 10) and (getPlayerItemCount(cid,2182) >= 1) and (getPlayerItemCount(cid,2186) >= 1) and (getPlayerItemCount(cid,2185) >= 1) and (getPlayerItemCount(cid,2181) >= 1) and (getPlayerItemCount(cid,2183) >= 1) and (getPlayerItemCount(cid,2190) >= 1) and (getPlayerItemCount(cid,2191) >= 1) and (getPlayerItemCount(cid,2188) >= 1) and (getPlayerItemCount(cid,2189) >= 1) and (getPlayerItemCount(cid,2187) >= 1) then
							if getPlayerStorageValue(cid, 10006) <= 0 then
								doPlayerRemoveItem(cid, 5809, 1) 
								doPlayerRemoveItem(cid, 2193, 20) 
								doPlayerRemoveItem(cid, 5904, 10) 
								doPlayerRemoveItem(cid, 2182, 1) 
								doPlayerRemoveItem(cid, 2186, 1) 
								doPlayerRemoveItem(cid, 2185, 1) 
								doPlayerRemoveItem(cid, 2181, 1) 
								doPlayerRemoveItem(cid, 2183, 1) 
								doPlayerRemoveItem(cid, 2190, 1) 
								doPlayerRemoveItem(cid, 2191, 1) 
								doPlayerRemoveItem(cid, 2188, 1) 
								doPlayerRemoveItem(cid, 2189, 1)
								doPlayerRemoveItem(cid, 2187, 1)
								doPlayerAddOutfit(cid, 130, 1)
								local pos = getCreaturePosition(cid)
								doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
							else
								selfSay('You already have this addon', cid)
							end
						else
							selfSay('You do not have the required item', cid)
						end
					elseif msgcontains(msg, "first mage addon") and getPlayerSex(cid) == 0 then
						selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
						Topic[cid] = 1
							elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 0 then
								if (getPlayerItemCount(cid,5958) >= 1) then
									if getPlayerStorageValue(cid, 10006) <= 0 then
										doPlayerRemoveItem(cid, 5958, 1) 
										doPlayerAddOutfit(cid, 138, 1)
										local pos = getCreaturePosition(cid)
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
									else
										selfSay('You already have this addon', cid)
									end
								else
									selfSay('You do not have the required itens', cid)
								end
							elseif msgcontains(msg, "no") then
								selfSay('Alright then. Come back when you got the neccessary items.', cid)
							end
					elseif msgcontains(msg, "second mage addon") and getPlayerSex(cid) == 1 then
						selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
						Topic[cid] = 1
							elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 1 then
								if (getPlayerItemCount(cid,5903) >= 1) then
									if getPlayerStorageValue(cid, 10006) <= 0 then
										doPlayerRemoveItem(cid, 5903, 1) 
										doPlayerAddOutfit(cid, 130, 2)
										local pos = getCreaturePosition(cid)
										doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
									else
										selfSay('You already have this addon', cid)
									end
								else
									selfSay('You do not have the required item', cid)
								end
							end
							 end
						elseif msgcontains(msg, "second mage addon") and getPlayerSex(cid) == 0 then
							selfSay('Do you want {first mage addon} for 1 ferumbras\' hat?', cid)
							Topic[cid] = 1
								elseif Topic[cid] == 1 and msgcontains(msg, "yes") and getPlayerSex(cid) == 0 then
									if (getPlayerItemCount(cid,5894) >= 70) and (getPlayerItemCount(cid,5911) >= 20) and (getPlayerItemCount(cid,5883) >= 40) and (getPlayerItemCount(cid,5922) >= 35) and (getPlayerItemCount(cid,5886) >= 10) and (getPlayerItemCount(cid,5881) >= 60) and (getPlayerItemCount(cid,5882) >= 40) and (getPlayerItemCount(cid,5904) >= 15) and (getPlayerItemCount(cid,5905) >= 30) then
										if getPlayerStorageValue(cid, 10006) <= 0 then
											doPlayerRemoveItem(cid, 5894, 70) 
											doPlayerRemoveItem(cid, 5911, 20) 
											doPlayerRemoveItem(cid, 5883, 40) 
											doPlayerRemoveItem(cid, 5922, 35) 
											doPlayerRemoveItem(cid, 5886, 10) 
											doPlayerRemoveItem(cid, 5881, 60) 
											doPlayerRemoveItem(cid, 5882, 40) 
											doPlayerRemoveItem(cid, 5904, 15) 
											doPlayerRemoveItem(cid, 5905, 30) 
											doPlayerAddOutfit(cid, 138, 2)
											local pos = getCreaturePosition(cid)
											doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
										else
											selfSay('You already have this addon', cid)
										end
									else
										selfSay('You do not have the required itens', cid)
									end
								elseif msgcontains(msg, "no") then
									selfSay('Alright then. Come back when you got the neccessary items.', cid)
								end
						end
					end
				end
 
function knight1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5880) >= 100) and (getPlayerItemCount(cid,5892) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5880, 100) 
				doPlayerRemoveItem(cid, 5892, 1) 
				doPlayerAddOutfit(cid, 131, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5880) >= 100) and (getPlayerItemCount(cid,5892) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5880, 100) 
				doPlayerRemoveItem(cid, 5892, 1) 
				doPlayerAddOutfit(cid, 139, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
 
function knight2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerItemCount(cid,5893) >= 100) and (getPlayerItemCount(cid,5924) >= 1) and (getPlayerItemCount(cid,5885) >= 1) and (getPlayerItemCount(cid,5887) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5893, 100) 
				doPlayerRemoveItem(cid, 5924, 1) 
				doPlayerRemoveItem(cid, 5885, 1) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerAddOutfit(cid, 131, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerItemCount(cid,5893) >= 100) and (getPlayerItemCount(cid,5924) >= 1) and (getPlayerItemCount(cid,5885) >= 1) and (getPlayerItemCount(cid,5887) >= 1) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveItem(cid, 5893, 100) 
				doPlayerRemoveItem(cid, 5924, 1) 
				doPlayerRemoveItem(cid, 5885, 1) 
				doPlayerRemoveItem(cid, 5887, 1) 
				doPlayerAddOutfit(cid, 139, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function nobleman1(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 132, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 140, 1)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
 
function nobleman2(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerSex(cid) == 1 then
        	if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 132, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required item', cid)
		end
        else
		if (getPlayerMoney(cid) >= 150000) then
			if getPlayerStorageValue(cid, 10006) <= 0 then
				doPlayerRemoveMoney(cid,150000)
				doPlayerAddOutfit(cid, 140, 2)
				local pos = getCreaturePosition(cid)
				doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
			else
				selfSay('You already have this addon', cid)
			end
		else
			selfSay('You do not have the required itens', cid)
		end
    end
end
-- END --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can give you {citizen}, {hunter}, {mage}, {knight}, {nobleman}, {summoner}, {warrior}, {barbarian}, {druid}, {wizard}, {oriental}, {pirate}, {assassin}, {beggar}, {shaman}, {norseman}, {nighmare}, {jester}, {brotherhood}, {demonhunter}, {yalaharian}, {warmaster} and {wayfarer} addons."})
 
local node1 = keywordHandler:addKeyword({'first citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {first citizen addon} for 100 minotaur leathers?'})
node1:addChildKeyword({'yes'}, citizen1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node2 = keywordHandler:addKeyword({'second citizen addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {second citizen addon} for 100 chicken feathers, 50 honeycombs and 1 legion helmet?'})
node2:addChildKeyword({'yes'}, citizen2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node3 = keywordHandler:addKeyword({'first hunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {first hunter addon} for 1 elane\'s crossbow, 100 lizard leather, 100 red dragon leather, 5 enchanted chicken wing, 1 piece of royal steel, 1 piece of draconian steel and 1 piece of hell steel?'})
node3:addChildKeyword({'yes'}, hunter1, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node4 = keywordHandler:addKeyword({'second hunter addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want {second hunter addon} for 1 sniper gloves?'})
node4:addChildKeyword({'yes'}, hunter2, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top