• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Small NPC Bug

Snow

New Member
Joined
Jan 16, 2008
Messages
381
Reaction score
0
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

item = 'You do not have the required items.'
done = 'Here you are.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
		if msgcontains(msg, 'offer') then
		selfSay('You can exchange some items for {spool of yarn}, {huge chunk of crude iron}, {piece of draconian steel}, {warrior's sweat}, {magic sulphur}, {enchanted chicken wing}, {piece of royal steel}, {piece of hell steel}, {engraved crossbow}, {fighting spirit}, {blue piece of cloth}, {green piece of cloth} {red piece of cloth}, {lottery ticket}, {staff}, {mermaid comb}, {damaged steel helmet}, {ceiron's wolf tooth chain}, {obsidian knife} and {blessed wooden stake}.', cid)

		       elseif msgcontains(msg, 'spider silk yarn') then
			if getPlayerItemCount(cid,5879) >= 10 then
				selfSay('Did you bring me 10 giant spider silks ?', cid)
				talk_state = 1
			else
				selfSay('I need 10 giant spider silks, to give you a spool of yarn. Come back when you have them.', cid)
				talk_state = 0
			end

			elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,5879) >= 10 then
			if doPlayerRemoveItem(cid,5879, 10) == TRUE then
							selfSay(done, cid)
			doPlayerAddItem(cid, 5886, 1)
			end
			else
				selfSay(item, cid)
			end

elseif msgcontains(msg, 'huge chunk of crude iron') then
if getPlayerItemCount(cid,2393) >= 1 then
selfSay('Did you bring a giant sword ?', cid)
talk_state = 2
else
selfSay('I need a giant sword, to give you a huge chunk of crude iron. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == TRUE then
				selfSay(done, cid)
doPlayerAddItem(cid,5892,1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'ticket') or msgcontains(msg, 'lottery') or msgcontains(msg, 'lottery ticket') or msgcontains(msg, 'lotery ticket') then
if getPlayerItemCount(cid,2160) >= 5 then
selfSay('Did you bring me 10 beholder eyes', cid)
talk_state = 15
else
selfSay('I need 10 beholder eyes, to give you a lottery ticket. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 15 then
talk_state = 0
if getPlayerItemCount(cid,5898) >= 10 then
if doPlayerRemoveItem(cid,5898,10) == TRUE then
selfSay(addon_give)
doPlayerAddItem(cid,5958,1)
end

else
selfSay(item, cid)
end


elseif msgcontains(msg, 'piece of draconian steel') then
if getPlayerItemCount(cid,2516) >= 1 then
selfSay('Did you bring me a dragon shield ?', cid)
talk_state = 3
else
selfSay('I need a dragon shield, to give you a piece of draconian steel. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2516) >= 1 then
if doPlayerRemoveItem(cid,2516,1) == TRUE then
doPlayerAddItem(cid,5889,1)
				selfSay(done, cid)
end
else
selfSay(item, cid)
end

		elseif msgcontains(msg, 'warrior's sweat') then
				if getPlayerItemCount(cid,2475) >= 4 then
					selfSay('Did you bring me 4 warrior helmets ?', cid)
					talk_state = 4
				else
					selfSay('I need 4 warrior helmets, to give you a warrior's sweat. Come back when you have them.', cid)
					talk_state = 0
				end
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			talk_state = 0
			if getPlayerItemCount(cid,2475) >= 4 then
					if doPlayerRemoveItem(cid,2475,4) == TRUE then
						doPlayerAddItem(cid,5885,1)
						selfSay(done, cid)
					end
				else
				selfSay(item, cid)
				end

elseif msgcontains(msg, 'magic sulphur') then
if getPlayerItemCount(cid,2392) >= 3 then
selfSay('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
selfSay('I need 3 fire swords, to give you a magic sulphur. Come back when you have them.', cid)
talk_state = 0
end

		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			talk_state = 0
			if getPlayerItemCount(cid,2392) >= 3 then
					if doPlayerRemoveItem(cid,2392,3) == TRUE then
						doPlayerAddItem(cid,5904,1)
										selfSay(done, cid)
				end
			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'enchanted chicken wing') then
			if getPlayerItemCount(cid,2195) >= 1 then
				selfSay('Did you bring me a boots of haste ?', cid)
				talk_state = 6
			else
				selfSay('I need a boots of haste, to give you the enchanted chicken wing. Come back when you have it.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 6 then
			talk_state = 0
			if getPlayerItemCount(cid,2195) >= 1 then
					if doPlayerRemoveItem(cid,2195,1) == TRUE then
						doPlayerAddItem(cid,5891,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end



		elseif msgcontains(msg, 'piece of royal steel') then
			if getPlayerItemCount(cid,2487) >= 1 then
				selfSay('Did you bring me a crown armor ?', cid)
				talk_state = 7
			else
				selfSay('I need a crown armor, to give you a piece of royal steel. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 7 then
			talk_state = 0
			if getPlayerItemCount(cid,2487) >= 1 then
					if doPlayerRemoveItem(cid,2487,1) == TRUE then
						doPlayerAddItem(cid,5887,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'piece of hell steel') then
			if getPlayerItemCount(cid,2462) >= 1 then
				selfSay('Did you bring me a devil helmet ?', cid)
				talk_state = 8
			else
				selfSay('I need a devil helmet, to give you a piece of hell steel. Come back when you have it.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 8 then
			talk_state = 0
			if getPlayerItemCount(cid,2462) >= 1 then
					if doPlayerRemoveItem(cid,2462,1) == TRUE then
						doPlayerAddItem(cid,5888,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'engraved crossbow') then
			if getPlayerItemCount(cid,6087) >= 1 and getPlayerItemCount(cid,6088) >= 1 and getPlayerItemCount(cid,6089) >= 1 and getPlayerItemCount(cid,6090) >= 1 and then
				selfSay('Did you bring me all the verses of the hymn ?', cid)
				talk_state = 9
			else
				selfSay('I need all verses of hymn, to give you the engraved crossbow. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 9 then
			talk_state = 0
			if getPlayerItemCount(cid,6087) >= 1 and getPlayerItemCount(cid,6088) >= 1 and getPlayerItemCount(cid,6089) >= 1 and getPlayerItemCount(cid,6090) >= 1 then
					if doPlayerRemoveItem(cid,6087,1) == TRUE and doPlayerRemoveItem(cid,6088,1) == TRUE and doPlayerRemoveItem(cid,6089,1) == TRUE and doPlayerRemoveItem(cid,6090,1) == TRUE then
						doPlayerAddItem(cid,5947,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'fighting spirit') then
			if getPlayerItemCount(cid,2498) >= 2 then
				selfSay('Did you bring me the 2 royal helmets ?', cid)
				talk_state = 10
			else
				selfSay('I need 2 Royal Helmets, to give you a fighting spirit. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 10 then
			talk_state = 0
			if getPlayerItemCount(cid,2498) >= 2 then
					if doPlayerRemoveItem(cid,2498,2) == TRUE then
						doPlayerAddItem(cid,5884,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'staff') then
			if getPlayerItemCount(cid,5877) >= 20 and if getPlayerItemCount(cid,5920) >= 20 and then
				selfSay('Did you bring me 20 green dragon leathers and 20 green dragon scales ?', cid)
				talk_state = 11
			else
				selfSay('I need 20 green dragon leathers and 20 green dragon scales, to give you the  simon the beggar\'s favorite staff. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 11 then
			talk_state = 0
			if getPlayerItemCount(cid,5877) >= 20 getPlayerItemCount(cid,5920) >= 20 then
					if doPlayerRemoveItem(cid,5877,20) == TRUE and doPlayerRemoveItem(cid,5920,20) == TRUEthen
						doPlayerAddItem(cid,6107,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'blue piece of cloth') then
			if getPlayerItemCount(cid,2663) >= 1 then
				selfSay('Did you bring me a mystic turban?', cid)
				talk_state = 12
			else
				selfSay('I need a mystic turban, to give you the blue piece of cloth. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 12 then
			talk_state = 0
			if getPlayerItemCount(cid,2663) >= 1 then
				if doPlayerRemoveItem(cid,2663,1) == TRUE then
						doPlayerAddItem(cid,5912,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'green piece of cloth') then
			if getPlayerItemCount(cid,2652) >= 1 then
				selfSay('Did you bring me 20 green tunics ?', cid)
				talk_state = 13
			else
				selfSay('I need 20 green tunics, to give you a green piece of cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 13 then
			talk_state = 0
			if getPlayerItemCount(cid,2652) >= 20 then
				if doPlayerRemoveItem(cid,2652,20) == TRUE then
						doPlayerAddItem(cid,5910,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'red piece of cloth') then
			if getPlayerItemCount(cid,2655) >= 1 then
				selfSay('Did you bring me a red robe ?', cid)
				talk_state = 14
			else
				selfSay('I need a red robe, to give you a red piece of cloth. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 14 then
			talk_state = 0
			if getPlayerItemCount(cid,2655) >= 1 then
				if doPlayerRemoveItem(cid,2655,1) == TRUE then
						doPlayerAddItem(cid,5911,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end
		elseif msgcontains(msg, 'mermaid comb') then
			if getPlayerItemCount(cid,5480) >= 1 then
				selfSay('Did you bring me a cat'/s paw ?', cid)
				talk_state = 15
			else
				selfSay('I need a cat'/s paw, to give you a mermaid comb. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 15 then
			talk_state = 0
			if getPlayerItemCount(cid,5480) >= 1 then
				if doPlayerRemoveItem(cid,5480,1) == TRUE then
						doPlayerAddItem(cid,5945,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end
		elseif msgcontains(msg, 'damaged steel helmet') then
			if getPlayerItemCount(cid,3957) >= 51 then
				selfSay('Did you bring me a war horn ?', cid)
				talk_state = 16
			else
				selfSay('I need a war horn, to give you a ramsay the reckless lost helmet . Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 16 then
			talk_state = 0
			if getPlayerItemCount(cid,3957) >= 1 then
				if doPlayerRemoveItem(cid,3957,1) == TRUE then
						doPlayerAddItem(cid,5924,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end
		elseif msgcontains(msg, 'obsidian knife') then
			if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
				selfSay('Did you bring me a piece of draconian steel and an obsidian lance ?', cid)
				talk_state = 17
			else
				selfSay('I need a war horn, to give you an obsidian knife . Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 17 then
			talk_state = 0
			if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
				if doPlayerRemoveItem(cid,5889,1) == TRUE and doPlayerRemoveItem(cid,2425,1) == TRUE then
						doPlayerAddItem(cid,5924,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end
		elseif msgcontains(msg, 'ceiron/'s wolf tooth chain') then
			if getPlayerItemCount(cid,5908) >= 5 then
				selfSay('Did you bring me 10 demon horns ?', cid)
				talk_state = 18
			else
				selfSay('I need 10 demon horns, to give a ceiron'/s wolf tooth chain. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 18 then
			talk_state = 0
			if getPlayerItemCount(cid,5954) >= 10 then
				if doPlayerRemoveItem(cid,5954,10) == TRUE then
						doPlayerAddItem(cid,5940,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end
		elseif msgcontains(msg, 'blessed wooden stake') then
			if getPlayerItemCount(cid,5921) >= 10 then
				selfSay('Did you bring me 10 heaven blossoms ?', cid)
				talk_state = 18
			else
				selfSay('I need 10 heaven blossoms, to give a blessed wooden stake. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 19 then
			talk_state = 0
			if getPlayerItemCount(cid,5921) >= 1 then
				if doPlayerRemoveItem(cid,5921,1) == TRUE then
						doPlayerAddItem(cid,5942,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end



        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 18) then
            selfSay('Ok then.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

I'm having this error:
[31/05/2009 21:32:14] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/exchange.lua
[31/05/2009 21:32:15] data/npc/scripts/exchange.lua:19: ')' expected near 'sweat'


but there's probably more please fix it for me.
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

item = 'You do not have the required items.'
done = 'Here you are.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
		if msgcontains(msg, 'offer') then
		selfSay('You can here change some items for "spider silk yarn", "chunk of crude iron", "draconian steel", "warrior sweat", "magic sulphur", "enchanted chicken wing", "royal steel", "hell steel", "elane crossbow", "fighting spirit", "infernal bolt", "blue piece of cloth", "green piece of cloth", "red piece of cloth", "lottery ticket".', cid)

			elseif msgcontains(msg, 'spider silk yarn') then
			if getPlayerItemCount(cid,5879) >= 10 then
				selfSay('Did you bring me the 10 Giant Silks ?', cid)
				talk_state = 1
			else
				selfSay('I need a 10 Giant Spider Silks, to give you the spider silk yarn. Come back when you have them.', cid)
				talk_state = 0
			end

			elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,5879) >= 10 then
			if doPlayerRemoveItem(cid,5879, 10) == TRUE then
							selfSay(done, cid)
			doPlayerAddItem(cid, 5886, 1)
			end
			else
				selfSay(item, cid)
			end

elseif msgcontains(msg, 'chunk of crude iron') then
if getPlayerItemCount(cid,2393) >= 1 then
selfSay('Did you bring me the Giant Sword ?', cid)
talk_state = 2
else
selfSay('I need a Giant Sword, to give you the chunk of crude iron. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == TRUE then
				selfSay(done, cid)
doPlayerAddItem(cid,5892,1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'ticket') or msgcontains(msg, 'lottery') or msgcontains(msg, 'lottery ticket') or msgcontains(msg, 'lotery ticket') then
if getPlayerItemCount(cid,2160) >= 5 then
selfSay('Did you bring me the 5cc?', cid)
talk_state = 15
else
selfSay('I need a 5cc, to give you a lottery ticket. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 15 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 5 then
if doPlayerRemoveItem(cid,2160,5) == TRUE then
selfSay(addon_give)
doPlayerAddItem(cid,5957,1)
end

else
selfSay(item, cid)
end


elseif msgcontains(msg, 'draconian steel') then
if getPlayerItemCount(cid,2516) >= 1 then
selfSay('Did you bring me Dragon Shield ?', cid)
talk_state = 3
else
selfSay('I need Dragon Shield, to give you the draconian steel. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2516) >= 1 then
if doPlayerRemoveItem(cid,2516,1) == TRUE then
doPlayerAddItem(cid,5889,1)
				selfSay(done, cid)
end
else
selfSay(item, cid)
end

		elseif msgcontains(msg, 'warrior sweat') then
				if getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 then
					selfSay('Did you bring me 4 warrior helmets?', cid)
					talk_state = 4
				else
					selfSay('I need 4 warrior helmets, to give you the warrior sweat. Come back when you have them.', cid)
					talk_state = 0
				end
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			talk_state = 0
			if getPlayerItemCount(cid,2475) >= 4 then
					if doPlayerRemoveItem(cid,2475,1) == TRUE and doPlayerRemoveItem(cid,2475,1) == TRUE and doPlayerRemoveItem(cid,2475,1) == TRUE and doPlayerRemoveItem(cid,2475,1) == TRUE then
						doPlayerAddItem(cid,5885,1)
						selfSay(done, cid)
					end
				else
				selfSay(item, cid)
				end

elseif msgcontains(msg, 'magic sulphur') then
if getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 then
selfSay('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
selfSay('I need 3 fire swords, to give you the magic sulpher. Come back when you have them.', cid)
talk_state = 0
end

		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			talk_state = 0
			if getPlayerItemCount(cid,2392) >= 3 then
					if doPlayerRemoveItem(cid,2392,1) == TRUE and doPlayerRemoveItem(cid,2392,1) == TRUE and doPlayerRemoveItem(cid,2392,1) == TRUE then
						doPlayerAddItem(cid,5904,1)
										selfSay(done, cid)
				end
			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'enchanted chicken wing') then
			if getPlayerItemCount(cid,2195) >= 1 then
				selfSay('Did you bring me boots of haste?', cid)
				talk_state = 6
			else
				selfSay('I need boots of haste, to give you the enchanted chicken wing. Come back when you have them.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 6 then
			talk_state = 0
			if getPlayerItemCount(cid,2195) >= 1 then
					if doPlayerRemoveItem(cid,2195,1) == TRUE then
						doPlayerAddItem(cid,5891,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end



		elseif msgcontains(msg, 'royal steel') then
			if getPlayerItemCount(cid,2487) >= 1 then
				selfSay('Did you bring me the Crown Armor ?', cid)
				talk_state = 7
			else
				selfSay('I need Crown Armor, to give you the royal steel. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 7 then
			talk_state = 0
			if getPlayerItemCount(cid,2487) >= 1 then
					if doPlayerRemoveItem(cid,2487,1) == TRUE then
						doPlayerAddItem(cid,5887,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'hell steel') then
			if getPlayerItemCount(cid,2462) >= 1 then
				selfSay('Did you bring me the Devil Helmet ?', cid)
				talk_state = 8
			else
				selfSay('I need a Devil Helmet, to give you the hell steel. Come back when you have them.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 8 then
			talk_state = 0
			if getPlayerItemCount(cid,2462) >= 1 then
					if doPlayerRemoveItem(cid,2462,1) == TRUE then
						doPlayerAddItem(cid,5888,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'crossbow') then
			if getPlayerItemCount(cid,5954) >= 15 then
				selfSay('Did you bring me the 15 demon horns?', cid)
				talk_state = 9
			else
				selfSay('I need a 15 demon horns, to give you the elane crossbow. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 9 then
			talk_state = 0
			if getPlayerItemCount(cid,5954) >= 15 then
					if doPlayerRemoveItem(cid,5954,15) == TRUE then
						doPlayerAddItem(cid,5947,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'fighting spirit') then
			if getPlayerItemCount(cid,2498) >= 1 and getPlayerItemCount(cid,2498) >= 1 then
				selfSay('Did you bring me the 2 Royal Helmets?', cid)
				talk_state = 10
			else
				selfSay('I need a 2 Royal Helmets, to give you the Fighting Spirit. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 10 then
			talk_state = 0
			if getPlayerItemCount(cid,2498) >= 2 then
					if doPlayerRemoveItem(cid,2498,1) == TRUE and doPlayerRemoveItem(cid,2498,1) == TRUE then
						doPlayerAddItem(cid,5884,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'infernal bolt') then
			if getPlayerItemCount(cid,5944) >= 1 then
				selfSay('Did you bring me the Soul Orb?', cid)
				talk_state = 11
			else
				selfSay('I need a Soul Orb, to give you the 10 Infernal Bolts. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 11 then
			talk_state = 0
			if getPlayerItemCount(cid,5944) >= 1 then
					if doPlayerRemoveItem(cid,5944,1) == TRUE then
						doPlayerAddItem(cid,6529,10)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'blue piece of cloth') then
			if getPlayerItemCount(cid,2663) >= 1 then
				selfSay('Did you bring me the Mystic Turban ?', cid)
				talk_state = 12
			else
				selfSay('I need a Mystic Turban, to give you the Blue Piece of Cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 12 then
			talk_state = 0
			if getPlayerItemCount(cid,2663) >= 1 then
				if doPlayerRemoveItem(cid,2663,1) == TRUE then
						doPlayerAddItem(cid,5912,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'green piece of cloth') then
			if getPlayerItemCount(cid,2652) >= 1 then
				selfSay('Did you bring me the Green Tunic ?', cid)
				talk_state = 13
			else
				selfSay('I need a Green Tunic, to give you the Green Piece of Cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 13 then
			talk_state = 0
			if getPlayerItemCount(cid,2652) >= 1 then
				if doPlayerRemoveItem(cid,2652,1) == TRUE then
						doPlayerAddItem(cid,5910,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'red piece of cloth') then
			if getPlayerItemCount(cid,2655) >= 1 then
				selfSay('Did you bring me the Red Robe ?', cid)
				talk_state = 14
			else
				selfSay('I need a Red Robe, to give you the Red Piece of Cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 14 then
			talk_state = 0
			if getPlayerItemCount(cid,2655) >= 1 then
				if doPlayerRemoveItem(cid,2655,1) == TRUE then
						doPlayerAddItem(cid,5911,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end


        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok than.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

Try this it should work
 
Code:
		selfSay('You can exchange some items for {spool of yarn}, {huge chunk of crude iron}, {piece of draconian steel}, {warrior's sweat}, {magic sulphur}, {enchanted chicken wing}, {piece of royal steel}, {piece of hell steel}, {engraved crossbow}, {fighting spirit}, {blue piece of cloth}, {green piece of cloth}, {red piece of cloth}, {lottery ticket}, {staff}, {mermaid comb}, {damaged steel helmet}, {ceiron's wolf tooth chain}, {obsidian knife} and {blessed wooden stake}.')

try this
deleted (, cid)
 
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid)			end
function onCreatureDisappear(cid)			npcHandler:onCreatureDisappear(cid)			end
function onCreatureSay(cid, type, msg)			npcHandler:onCreatureSay(cid, type, msg)		end
function onThink()					npcHandler:onThink()					end

item = 'You do not have the required items.'
done = 'Here you are.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
		if msgcontains(msg, 'offer') then
		selfSay('You can here change some items for "spider silk yarn", "chunk of crude iron", "draconian steel", "warrior sweat", "magic sulphur", "enchanted chicken wing", "royal steel", "hell steel", "elane crossbow", "fighting spirit", "infernal bolt", "blue piece of cloth", "green piece of cloth", "red piece of cloth", "lottery ticket".', cid)

			elseif msgcontains(msg, 'spider silk yarn') then
			if getPlayerItemCount(cid,5879) >= 10 then
				selfSay('Did you bring me the 10 Giant Silks ?', cid)
				talk_state = 1
			else
				selfSay('I need a 10 Giant Spider Silks, to give you the spider silk yarn. Come back when you have them.', cid)
				talk_state = 0
			end

			elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,5879) >= 10 then
			if doPlayerRemoveItem(cid,5879, 10) == TRUE then
							selfSay(done, cid)
			doPlayerAddItem(cid, 5886, 1)
			end
			else
				selfSay(item, cid)
			end

elseif msgcontains(msg, 'chunk of crude iron') then
if getPlayerItemCount(cid,2393) >= 1 then
selfSay('Did you bring me the Giant Sword ?', cid)
talk_state = 2
else
selfSay('I need a Giant Sword, to give you the chunk of crude iron. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == TRUE then
				selfSay(done, cid)
doPlayerAddItem(cid,5892,1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'ticket') or msgcontains(msg, 'lottery') or msgcontains(msg, 'lottery ticket') or msgcontains(msg, 'lotery ticket') then
if getPlayerItemCount(cid,2160) >= 5 then
selfSay('Did you bring me the 5cc?', cid)
talk_state = 15
else
selfSay('I need a 5cc, to give you a lottery ticket. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 15 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 5 then
if doPlayerRemoveItem(cid,2160,5) == TRUE then
selfSay(addon_give)
doPlayerAddItem(cid,5957,1)
end

else
selfSay(item, cid)
end


elseif msgcontains(msg, 'draconian steel') then
if getPlayerItemCount(cid,2516) >= 1 then
selfSay('Did you bring me Dragon Shield ?', cid)
talk_state = 3
else
selfSay('I need Dragon Shield, to give you the draconian steel. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2516) >= 1 then
if doPlayerRemoveItem(cid,2516,1) == TRUE then
doPlayerAddItem(cid,5889,1)
				selfSay(done, cid)
end
else
selfSay(item, cid)
end

		elseif msgcontains(msg, 'warrior sweat') then
				if getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 and getPlayerItemCount(cid,2475) >= 1 then
					selfSay('Did you bring me 4 warrior helmets?', cid)
					talk_state = 4
				else
					selfSay('I need 4 warrior helmets, to give you the warrior sweat. Come back when you have them.', cid)
					talk_state = 0
				end
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			talk_state = 0
			if getPlayerItemCount(cid,2475) >= 4 then
					if doPlayerRemoveItem(cid,2475,1) == TRUE and doPlayerRemoveItem(cid,2475,1) == TRUE and doPlayerRemoveItem(cid,2475,1) == TRUE and doPlayerRemoveItem(cid,2475,1) == TRUE then
						doPlayerAddItem(cid,5885,1)
						selfSay(done, cid)
					end
				else
				selfSay(item, cid)
				end

elseif msgcontains(msg, 'magic sulphur') then
if getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 and getPlayerItemCount(cid,2392) >= 1 then
selfSay('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
selfSay('I need 3 fire swords, to give you the magic sulpher. Come back when you have them.', cid)
talk_state = 0
end

		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			talk_state = 0
			if getPlayerItemCount(cid,2392) >= 3 then
					if doPlayerRemoveItem(cid,2392,1) == TRUE and doPlayerRemoveItem(cid,2392,1) == TRUE and doPlayerRemoveItem(cid,2392,1) == TRUE then
						doPlayerAddItem(cid,5904,1)
										selfSay(done, cid)
				end
			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'enchanted chicken wing') then
			if getPlayerItemCount(cid,2195) >= 1 then
				selfSay('Did you bring me boots of haste?', cid)
				talk_state = 6
			else
				selfSay('I need boots of haste, to give you the enchanted chicken wing. Come back when you have them.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 6 then
			talk_state = 0
			if getPlayerItemCount(cid,2195) >= 1 then
					if doPlayerRemoveItem(cid,2195,1) == TRUE then
						doPlayerAddItem(cid,5891,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end



		elseif msgcontains(msg, 'royal steel') then
			if getPlayerItemCount(cid,2487) >= 1 then
				selfSay('Did you bring me the Crown Armor ?', cid)
				talk_state = 7
			else
				selfSay('I need Crown Armor, to give you the royal steel. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 7 then
			talk_state = 0
			if getPlayerItemCount(cid,2487) >= 1 then
					if doPlayerRemoveItem(cid,2487,1) == TRUE then
						doPlayerAddItem(cid,5887,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'hell steel') then
			if getPlayerItemCount(cid,2462) >= 1 then
				selfSay('Did you bring me the Devil Helmet ?', cid)
				talk_state = 8
			else
				selfSay('I need a Devil Helmet, to give you the hell steel. Come back when you have them.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 8 then
			talk_state = 0
			if getPlayerItemCount(cid,2462) >= 1 then
					if doPlayerRemoveItem(cid,2462,1) == TRUE then
						doPlayerAddItem(cid,5888,1)
										selfSay(done, cid)
					end
			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'crossbow') then
			if getPlayerItemCount(cid,5954) >= 15 then
				selfSay('Did you bring me the 15 demon horns?', cid)
				talk_state = 9
			else
				selfSay('I need a 15 demon horns, to give you the elane crossbow. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 9 then
			talk_state = 0
			if getPlayerItemCount(cid,5954) >= 15 then
					if doPlayerRemoveItem(cid,5954,15) == TRUE then
						doPlayerAddItem(cid,5947,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'fighting spirit') then
			if getPlayerItemCount(cid,2498) >= 1 and getPlayerItemCount(cid,2498) >= 1 then
				selfSay('Did you bring me the 2 Royal Helmets?', cid)
				talk_state = 10
			else
				selfSay('I need a 2 Royal Helmets, to give you the Fighting Spirit. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 10 then
			talk_state = 0
			if getPlayerItemCount(cid,2498) >= 2 then
					if doPlayerRemoveItem(cid,2498,1) == TRUE and doPlayerRemoveItem(cid,2498,1) == TRUE then
						doPlayerAddItem(cid,5884,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end


		elseif msgcontains(msg, 'infernal bolt') then
			if getPlayerItemCount(cid,5944) >= 1 then
				selfSay('Did you bring me the Soul Orb?', cid)
				talk_state = 11
			else
				selfSay('I need a Soul Orb, to give you the 10 Infernal Bolts. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 11 then
			talk_state = 0
			if getPlayerItemCount(cid,5944) >= 1 then
					if doPlayerRemoveItem(cid,5944,1) == TRUE then
						doPlayerAddItem(cid,6529,10)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'blue piece of cloth') then
			if getPlayerItemCount(cid,2663) >= 1 then
				selfSay('Did you bring me the Mystic Turban ?', cid)
				talk_state = 12
			else
				selfSay('I need a Mystic Turban, to give you the Blue Piece of Cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 12 then
			talk_state = 0
			if getPlayerItemCount(cid,2663) >= 1 then
				if doPlayerRemoveItem(cid,2663,1) == TRUE then
						doPlayerAddItem(cid,5912,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'green piece of cloth') then
			if getPlayerItemCount(cid,2652) >= 1 then
				selfSay('Did you bring me the Green Tunic ?', cid)
				talk_state = 13
			else
				selfSay('I need a Green Tunic, to give you the Green Piece of Cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 13 then
			talk_state = 0
			if getPlayerItemCount(cid,2652) >= 1 then
				if doPlayerRemoveItem(cid,2652,1) == TRUE then
						doPlayerAddItem(cid,5910,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end

		elseif msgcontains(msg, 'red piece of cloth') then
			if getPlayerItemCount(cid,2655) >= 1 then
				selfSay('Did you bring me the Red Robe ?', cid)
				talk_state = 14
			else
				selfSay('I need a Red Robe, to give you the Red Piece of Cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 14 then
			talk_state = 0
			if getPlayerItemCount(cid,2655) >= 1 then
				if doPlayerRemoveItem(cid,2655,1) == TRUE then
						doPlayerAddItem(cid,5911,1)
										selfSay(done, cid)
					end

			else
				selfSay(item, cid)
			end


        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
            selfSay('Ok than.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

Try this it should work


Mine is with much more stuff added I don't have problem on that one.
 
Code:
		selfSay('You can exchange some items for {spool of yarn}, {huge chunk of crude iron}, {piece of draconian steel}, {warrior's sweat}, {magic sulphur}, {enchanted chicken wing}, {piece of royal steel}, {piece of hell steel}, {engraved crossbow}, {fighting spirit}, {blue piece of cloth}, {green piece of cloth}, {red piece of cloth}, {lottery ticket}, {staff}, {mermaid comb}, {damaged steel helmet}, {ceiron's wolf tooth chain}, {obsidian knife} and {blessed wooden stake}.')

try this
deleted (, cid)


I get this:
[01/06/2009 13:28:09] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/exchange.lua
[01/06/2009 13:28:09] data/npc/scripts/exchange.lua:19: ')' expected near 's'
 
Fixed the original one (not tested :o)
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

local item = 'You do not have the required items.'
local done = 'Here you are.'

function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	
		if msgcontains(msg, 'offer') then
		npcHandler:say('You can exchange some items for {spool of yarn}, {huge chunk of crude iron}, {piece of draconian steel}, {warrior\'s sweat}, {magic sulphur}, {enchanted chicken wing}, {piece of royal steel}, {piece of hell steel}, {engraved crossbow}, {fighting spirit}, {blue piece of cloth}, {green piece of cloth} {red piece of cloth}, {lottery ticket}, {staff}, {mermaid comb}, {damaged steel helmet}, {ceiron\'s wolf tooth chain}, {obsidian knife} and {blessed wooden stake}.', cid)

		       elseif msgcontains(msg, 'spider silk yarn') then
			if getPlayerItemCount(cid,5879) >= 10 then
				npcHandler:say('Did you bring me 10 giant spider silks ?', cid)
				talk_state = 1
			else
				npcHandler:say('I need 10 giant spider silks, to give you a spool of yarn. Come back when you have them.', cid)
				talk_state = 0
			end

			elseif msgcontains(msg, 'yes') and talk_state == 1 then
			talk_state = 0
			if getPlayerItemCount(cid,5879) >= 10 then
			if doPlayerRemoveItem(cid,5879, 10) == TRUE then
							npcHandler:say(done, cid)
			doPlayerAddItem(cid, 5886, 1)
			end
			else
				npcHandler:say(item, cid)
			end

elseif msgcontains(msg, 'huge chunk of crude iron') then
if getPlayerItemCount(cid,2393) >= 1 then
npcHandler:say('Did you bring a giant sword ?', cid)
talk_state = 2
else
npcHandler:say('I need a giant sword, to give you a huge chunk of crude iron. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == TRUE then
				npcHandler:say(done, cid)
doPlayerAddItem(cid,5892,1)
end
else
npcHandler:say(item, cid)
end
elseif msgcontains(msg, 'ticket') or msgcontains(msg, 'lottery') or msgcontains(msg, 'lottery ticket') or msgcontains(msg, 'lotery ticket') then
if getPlayerItemCount(cid,2160) >= 5 then
npcHandler:say('Did you bring me 10 beholder eyes', cid)
talk_state = 15
else
npcHandler:say('I need 10 beholder eyes, to give you a lottery ticket. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 15 then
talk_state = 0
if getPlayerItemCount(cid,5898) >= 10 then
if doPlayerRemoveItem(cid,5898,10) == TRUE then
npcHandler:say(addon_give)
doPlayerAddItem(cid,5958,1)
end

else
npcHandler:say(item, cid)
end


elseif msgcontains(msg, 'piece of draconian steel') then
if getPlayerItemCount(cid,2516) >= 1 then
npcHandler:say('Did you bring me a dragon shield ?', cid)
talk_state = 3
else
npcHandler:say('I need a dragon shield, to give you a piece of draconian steel. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2516) >= 1 then
if doPlayerRemoveItem(cid,2516,1) == TRUE then
doPlayerAddItem(cid,5889,1)
				npcHandler:say(done, cid)
end
else
npcHandler:say(item, cid)
end

		elseif msgcontains(msg, 'warrior's sweat') then
				if getPlayerItemCount(cid,2475) >= 4 then
					npcHandler:say('Did you bring me 4 warrior helmets ?', cid)
					talk_state = 4
				else
					npcHandler:say('I need 4 warrior helmets, to give you a warrior's sweat. Come back when you have them.', cid)
					talk_state = 0
				end
		elseif msgcontains(msg, 'yes') and talk_state == 4 then
			talk_state = 0
			if getPlayerItemCount(cid,2475) >= 4 then
					if doPlayerRemoveItem(cid,2475,4) == TRUE then
						doPlayerAddItem(cid,5885,1)
						npcHandler:say(done, cid)
					end
				else
				npcHandler:say(item, cid)
				end

elseif msgcontains(msg, 'magic sulphur') then
if getPlayerItemCount(cid,2392) >= 3 then
npcHandler:say('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
npcHandler:say('I need 3 fire swords, to give you a magic sulphur. Come back when you have them.', cid)
talk_state = 0
end

		elseif msgcontains(msg, 'yes') and talk_state == 5 then
			talk_state = 0
			if getPlayerItemCount(cid,2392) >= 3 then
					if doPlayerRemoveItem(cid,2392,3) == TRUE then
						doPlayerAddItem(cid,5904,1)
										npcHandler:say(done, cid)
				end
			else
				npcHandler:say(item, cid)
			end

		elseif msgcontains(msg, 'enchanted chicken wing') then
			if getPlayerItemCount(cid,2195) >= 1 then
				npcHandler:say('Did you bring me a boots of haste ?', cid)
				talk_state = 6
			else
				npcHandler:say('I need a boots of haste, to give you the enchanted chicken wing. Come back when you have it.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 6 then
			talk_state = 0
			if getPlayerItemCount(cid,2195) >= 1 then
					if doPlayerRemoveItem(cid,2195,1) == TRUE then
						doPlayerAddItem(cid,5891,1)
										npcHandler:say(done, cid)
					end
			else
				npcHandler:say(item, cid)
			end



		elseif msgcontains(msg, 'piece of royal steel') then
			if getPlayerItemCount(cid,2487) >= 1 then
				npcHandler:say('Did you bring me a crown armor ?', cid)
				talk_state = 7
			else
				npcHandler:say('I need a crown armor, to give you a piece of royal steel. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 7 then
			talk_state = 0
			if getPlayerItemCount(cid,2487) >= 1 then
					if doPlayerRemoveItem(cid,2487,1) == TRUE then
						doPlayerAddItem(cid,5887,1)
										npcHandler:say(done, cid)
					end
			else
				npcHandler:say(item, cid)
			end


		elseif msgcontains(msg, 'piece of hell steel') then
			if getPlayerItemCount(cid,2462) >= 1 then
				npcHandler:say('Did you bring me a devil helmet ?', cid)
				talk_state = 8
			else
				npcHandler:say('I need a devil helmet, to give you a piece of hell steel. Come back when you have it.', cid)
				talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 8 then
			talk_state = 0
			if getPlayerItemCount(cid,2462) >= 1 then
					if doPlayerRemoveItem(cid,2462,1) == TRUE then
						doPlayerAddItem(cid,5888,1)
										npcHandler:say(done, cid)
					end
			else
				npcHandler:say(item, cid)
			end

		elseif msgcontains(msg, 'engraved crossbow') then
			if getPlayerItemCount(cid,6087) >= 1 and getPlayerItemCount(cid,6088) >= 1 and getPlayerItemCount(cid,6089) >= 1 and getPlayerItemCount(cid,6090) >= 1 and then
				npcHandler:say('Did you bring me all the verses of the hymn ?', cid)
				talk_state = 9
			else
				npcHandler:say('I need all verses of hymn, to give you the engraved crossbow. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 9 then
			talk_state = 0
			if getPlayerItemCount(cid,6087) >= 1 and getPlayerItemCount(cid,6088) >= 1 and getPlayerItemCount(cid,6089) >= 1 and getPlayerItemCount(cid,6090) >= 1 then
					if doPlayerRemoveItem(cid,6087,1) == TRUE and doPlayerRemoveItem(cid,6088,1) == TRUE and doPlayerRemoveItem(cid,6089,1) == TRUE and doPlayerRemoveItem(cid,6090,1) == TRUE then
						doPlayerAddItem(cid,5947,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end

		elseif msgcontains(msg, 'fighting spirit') then
			if getPlayerItemCount(cid,2498) >= 2 then
				npcHandler:say('Did you bring me the 2 royal helmets ?', cid)
				talk_state = 10
			else
				npcHandler:say('I need 2 Royal Helmets, to give you a fighting spirit. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 10 then
			talk_state = 0
			if getPlayerItemCount(cid,2498) >= 2 then
					if doPlayerRemoveItem(cid,2498,2) == TRUE then
						doPlayerAddItem(cid,5884,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end


		elseif msgcontains(msg, 'staff') then
			if getPlayerItemCount(cid,5877) >= 20 and if getPlayerItemCount(cid,5920) >= 20 and then
				npcHandler:say('Did you bring me 20 green dragon leathers and 20 green dragon scales ?', cid)
				talk_state = 11
			else
				npcHandler:say('I need 20 green dragon leathers and 20 green dragon scales, to give you the  simon the beggar\'s favorite staff. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 11 then
			talk_state = 0
			if getPlayerItemCount(cid,5877) >= 20 getPlayerItemCount(cid,5920) >= 20 then
					if doPlayerRemoveItem(cid,5877,20) == TRUE and doPlayerRemoveItem(cid,5920,20) == TRUEthen
						doPlayerAddItem(cid,6107,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end

		elseif msgcontains(msg, 'blue piece of cloth') then
			if getPlayerItemCount(cid,2663) >= 1 then
				npcHandler:say('Did you bring me a mystic turban?', cid)
				talk_state = 12
			else
				npcHandler:say('I need a mystic turban, to give you the blue piece of cloth. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 12 then
			talk_state = 0
			if getPlayerItemCount(cid,2663) >= 1 then
				if doPlayerRemoveItem(cid,2663,1) == TRUE then
						doPlayerAddItem(cid,5912,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end

		elseif msgcontains(msg, 'green piece of cloth') then
			if getPlayerItemCount(cid,2652) >= 1 then
				npcHandler:say('Did you bring me 20 green tunics ?', cid)
				talk_state = 13
			else
				npcHandler:say('I need 20 green tunics, to give you a green piece of cloth. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 13 then
			talk_state = 0
			if getPlayerItemCount(cid,2652) >= 20 then
				if doPlayerRemoveItem(cid,2652,20) == TRUE then
						doPlayerAddItem(cid,5910,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end

		elseif msgcontains(msg, 'red piece of cloth') then
			if getPlayerItemCount(cid,2655) >= 1 then
				npcHandler:say('Did you bring me a red robe ?', cid)
				talk_state = 14
			else
				npcHandler:say('I need a red robe, to give you a red piece of cloth. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 14 then
			talk_state = 0
			if getPlayerItemCount(cid,2655) >= 1 then
				if doPlayerRemoveItem(cid,2655,1) == TRUE then
						doPlayerAddItem(cid,5911,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end
		elseif msgcontains(msg, 'mermaid comb') then
			if getPlayerItemCount(cid,5480) >= 1 then
				npcHandler:say('Did you bring me a cat\'s paw ?', cid)
				talk_state = 15
			else
				npcHandler:say('I need a cat\'s paw, to give you a mermaid comb. Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 15 then
			talk_state = 0
			if getPlayerItemCount(cid,5480) >= 1 then
				if doPlayerRemoveItem(cid,5480,1) == TRUE then
						doPlayerAddItem(cid,5945,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end
		elseif msgcontains(msg, 'damaged steel helmet') then
			if getPlayerItemCount(cid,3957) >= 51 then
				npcHandler:say('Did you bring me a war horn ?', cid)
				talk_state = 16
			else
				npcHandler:say('I need a war horn, to give you a ramsay the reckless lost helmet . Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 16 then
			talk_state = 0
			if getPlayerItemCount(cid,3957) >= 1 then
				if doPlayerRemoveItem(cid,3957,1) == TRUE then
						doPlayerAddItem(cid,5924,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end
		elseif msgcontains(msg, 'obsidian knife') then
			if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
				npcHandler:say('Did you bring me a piece of draconian steel and an obsidian lance ?', cid)
				talk_state = 17
			else
				npcHandler:say('I need a war horn, to give you an obsidian knife . Come back when you have it.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 17 then
			talk_state = 0
			if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
				if doPlayerRemoveItem(cid,5889,1) == TRUE and doPlayerRemoveItem(cid,2425,1) == TRUE then
						doPlayerAddItem(cid,5924,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end
		elseif msgcontains(msg, 'ceiron\'s wolf tooth chain') then
			if getPlayerItemCount(cid,5908) >= 5 then
				npcHandler:say('Did you bring me 10 demon horns ?', cid)
				talk_state = 18
			else
				npcHandler:say('I need 10 demon horns, to give a ceiron\'s wolf tooth chain. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 18 then
			talk_state = 0
			if getPlayerItemCount(cid,5954) >= 10 then
				if doPlayerRemoveItem(cid,5954,10) == TRUE then
						doPlayerAddItem(cid,5940,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end
		elseif msgcontains(msg, 'blessed wooden stake') then
			if getPlayerItemCount(cid,5921) >= 10 then
				npcHandler:say('Did you bring me 10 heaven blossoms ?', cid)
				talk_state = 18
			else
				npcHandler:say('I need 10 heaven blossoms, to give a blessed wooden stake. Come back when you have them.', cid)
				talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 19 then
			talk_state = 0
			if getPlayerItemCount(cid,5921) >= 1 then
				if doPlayerRemoveItem(cid,5921,1) == TRUE then
						doPlayerAddItem(cid,5942,1)
										npcHandler:say(done, cid)
					end

			else
				npcHandler:say(item, cid)
			end



        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 18) then
            npcHandler:say('Ok then.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Let me know in case you have any additional errors.
 
[01/06/2009 14:07:09] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/exchange.lua
[01/06/2009 14:07:09] data/npc/scripts/exchange.lua:99: ')' expected near 's'

this one :(
 
Try this one, should work :).

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

local item = 'You do not have the required items.'
local done = 'Here you are.'

function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
        end
       
                if msgcontains(msg, 'offer') then
                npcHandler:say('You can exchange some items for {spool of yarn}, {huge chunk of crude iron}, {piece of draconian steel}, {warrior\'s sweat}, {magic sulphur}, {enchanted chicken wing}, {piece of royal steel}, {piece of hell steel}, {engraved crossbow}, {fighting spirit}, {blue piece of cloth}, {green piece of cloth} {red piece of cloth}, {lottery ticket}, {staff}, {mermaid comb}, {damaged steel helmet}, {ceiron\'s wolf tooth chain}, {obsidian knife} and {blessed wooden stake}.', cid)

                       elseif msgcontains(msg, 'spider silk yarn') then
                        if getPlayerItemCount(cid,5879) >= 10 then
                                npcHandler:say('Did you bring me 10 giant spider silks ?', cid)
                                talk_state = 1
                        else
                                npcHandler:say('I need 10 giant spider silks, to give you a spool of yarn. Come back when you have them.', cid)
                                talk_state = 0
                        end

                        elseif msgcontains(msg, 'yes') and talk_state == 1 then
                        talk_state = 0
                        if getPlayerItemCount(cid,5879) >= 10 then
                        if doPlayerRemoveItem(cid,5879, 10) == TRUE then
                                                        npcHandler:say(done, cid)
                        doPlayerAddItem(cid, 5886, 1)
                        end
                        else
                                npcHandler:say(item, cid)
                        end

elseif msgcontains(msg, 'huge chunk of crude iron') then
if getPlayerItemCount(cid,2393) >= 1 then
npcHandler:say('Did you bring a giant sword ?', cid)
talk_state = 2
else
npcHandler:say('I need a giant sword, to give you a huge chunk of crude iron. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 then
if doPlayerRemoveItem(cid,2393,1) == TRUE then
                                npcHandler:say(done, cid)
doPlayerAddItem(cid,5892,1)
end
else
npcHandler:say(item, cid)
end
elseif msgcontains(msg, 'ticket') or msgcontains(msg, 'lottery') or msgcontains(msg, 'lottery ticket') or msgcontains(msg, 'lotery ticket') then
if getPlayerItemCount(cid,2160) >= 5 then
npcHandler:say('Did you bring me 10 beholder eyes', cid)
talk_state = 15
else
npcHandler:say('I need 10 beholder eyes, to give you a lottery ticket. Come back when you have them.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 15 then
talk_state = 0
if getPlayerItemCount(cid,5898) >= 10 then
if doPlayerRemoveItem(cid,5898,10) == TRUE then
npcHandler:say(addon_give)
doPlayerAddItem(cid,5958,1)
end

else
npcHandler:say(item, cid)
end


elseif msgcontains(msg, 'piece of draconian steel') then
if getPlayerItemCount(cid,2516) >= 1 then
npcHandler:say('Did you bring me a dragon shield ?', cid)
talk_state = 3
else
npcHandler:say('I need a dragon shield, to give you a piece of draconian steel. Come back when you have it.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,2516) >= 1 then
if doPlayerRemoveItem(cid,2516,1) == TRUE then
doPlayerAddItem(cid,5889,1)
                                npcHandler:say(done, cid)
end
else
npcHandler:say(item, cid)
end

                elseif msgcontains(msg, 'warrior\'s sweat') then
                                if getPlayerItemCount(cid,2475) >= 4 then
                                        npcHandler:say('Did you bring me 4 warrior helmets ?', cid)
                                        talk_state = 4
                                else
                                        npcHandler:say('I need 4 warrior helmets, to give you a warrior\'s sweat. Come back when you have them.', cid)
                                        talk_state = 0
                                end
                elseif msgcontains(msg, 'yes') and talk_state == 4 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2475) >= 4 then
                                        if doPlayerRemoveItem(cid,2475,4) == TRUE then
                                                doPlayerAddItem(cid,5885,1)
                                                npcHandler:say(done, cid)
                                        end
                                else
                                npcHandler:say(item, cid)
                                end

elseif msgcontains(msg, 'magic sulphur') then
if getPlayerItemCount(cid,2392) >= 3 then
npcHandler:say('Did you bring me 3 fire swords?', cid)
talk_state = 5
else
npcHandler:say('I need 3 fire swords, to give you a magic sulphur. Come back when you have them.', cid)
talk_state = 0
end

                elseif msgcontains(msg, 'yes') and talk_state == 5 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2392) >= 3 then
                                        if doPlayerRemoveItem(cid,2392,3) == TRUE then
                                                doPlayerAddItem(cid,5904,1)
                                                                                npcHandler:say(done, cid)
                                end
                        else
                                npcHandler:say(item, cid)
                        end

                elseif msgcontains(msg, 'enchanted chicken wing') then
                        if getPlayerItemCount(cid,2195) >= 1 then
                                npcHandler:say('Did you bring me a boots of haste ?', cid)
                                talk_state = 6
                        else
                                npcHandler:say('I need a boots of haste, to give you the enchanted chicken wing. Come back when you have it.', cid)
                                talk_state = 0
                        end

                elseif msgcontains(msg, 'yes') and talk_state == 6 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2195) >= 1 then
                                        if doPlayerRemoveItem(cid,2195,1) == TRUE then
                                                doPlayerAddItem(cid,5891,1)
                                                                                npcHandler:say(done, cid)
                                        end
                        else
                                npcHandler:say(item, cid)
                        end



                elseif msgcontains(msg, 'piece of royal steel') then
                        if getPlayerItemCount(cid,2487) >= 1 then
                                npcHandler:say('Did you bring me a crown armor ?', cid)
                                talk_state = 7
                        else
                                npcHandler:say('I need a crown armor, to give you a piece of royal steel. Come back when you have it.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 7 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2487) >= 1 then
                                        if doPlayerRemoveItem(cid,2487,1) == TRUE then
                                                doPlayerAddItem(cid,5887,1)
                                                                                npcHandler:say(done, cid)
                                        end
                        else
                                npcHandler:say(item, cid)
                        end


                elseif msgcontains(msg, 'piece of hell steel') then
                        if getPlayerItemCount(cid,2462) >= 1 then
                                npcHandler:say('Did you bring me a devil helmet ?', cid)
                                talk_state = 8
                        else
                                npcHandler:say('I need a devil helmet, to give you a piece of hell steel. Come back when you have it.', cid)
                                talk_state = 0
                        end

                elseif msgcontains(msg, 'yes') and talk_state == 8 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2462) >= 1 then
                                        if doPlayerRemoveItem(cid,2462,1) == TRUE then
                                                doPlayerAddItem(cid,5888,1)
                                                                                npcHandler:say(done, cid)
                                        end
                        else
                                npcHandler:say(item, cid)
                        end

                elseif msgcontains(msg, 'engraved crossbow') then
                        if getPlayerItemCount(cid,6087) >= 1 and getPlayerItemCount(cid,6088) >= 1 and getPlayerItemCount(cid,6089) >= 1 and getPlayerItemCount(cid,6090) >= 1 then
                                npcHandler:say('Did you bring me all the verses of the hymn ?', cid)
                                talk_state = 9
                        else
                                npcHandler:say('I need all verses of hymn, to give you the engraved crossbow. Come back when you have them.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 9 then
                        talk_state = 0
                        if getPlayerItemCount(cid,6087) >= 1 and getPlayerItemCount(cid,6088) >= 1 and getPlayerItemCount(cid,6089) >= 1 and getPlayerItemCount(cid,6090) >= 1 then
                                        if doPlayerRemoveItem(cid,6087,1) == TRUE and doPlayerRemoveItem(cid,6088,1) == TRUE and doPlayerRemoveItem(cid,6089,1) == TRUE and doPlayerRemoveItem(cid,6090,1) == TRUE then
                                                doPlayerAddItem(cid,5947,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end

                elseif msgcontains(msg, 'fighting spirit') then
                        if getPlayerItemCount(cid,2498) >= 2 then
                                npcHandler:say('Did you bring me the 2 royal helmets ?', cid)
                                talk_state = 10
                        else
                                npcHandler:say('I need 2 Royal Helmets, to give you a fighting spirit. Come back when you have them.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 10 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2498) >= 2 then
                                        if doPlayerRemoveItem(cid,2498,2) == TRUE then
                                                doPlayerAddItem(cid,5884,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end


                elseif msgcontains(msg, 'staff') then
                        if getPlayerItemCount(cid,5877) >= 20 and if getPlayerItemCount(cid,5920) >= 20 and then
                                npcHandler:say('Did you bring me 20 green dragon leathers and 20 green dragon scales ?', cid)
                                talk_state = 11
                        else
                                npcHandler:say('I need 20 green dragon leathers and 20 green dragon scales, to give you the  simon the beggar\'s favorite staff. Come back when you have them.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 11 then
                        talk_state = 0
                        if getPlayerItemCount(cid,5877) >= 20 getPlayerItemCount(cid,5920) >= 20 then
                                        if doPlayerRemoveItem(cid,5877,20) == TRUE and doPlayerRemoveItem(cid,5920,20) == TRUEthen
                                                doPlayerAddItem(cid,6107,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end

                elseif msgcontains(msg, 'blue piece of cloth') then
                        if getPlayerItemCount(cid,2663) >= 1 then
                                npcHandler:say('Did you bring me a mystic turban?', cid)
                                talk_state = 12
                        else
                                npcHandler:say('I need a mystic turban, to give you the blue piece of cloth. Come back when you have it.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 12 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2663) >= 1 then
                                if doPlayerRemoveItem(cid,2663,1) == TRUE then
                                                doPlayerAddItem(cid,5912,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end

                elseif msgcontains(msg, 'green piece of cloth') then
                        if getPlayerItemCount(cid,2652) >= 1 then
                                npcHandler:say('Did you bring me 20 green tunics ?', cid)
                                talk_state = 13
                        else
                                npcHandler:say('I need 20 green tunics, to give you a green piece of cloth. Come back when you have them.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 13 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2652) >= 20 then
                                if doPlayerRemoveItem(cid,2652,20) == TRUE then
                                                doPlayerAddItem(cid,5910,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end

                elseif msgcontains(msg, 'red piece of cloth') then
                        if getPlayerItemCount(cid,2655) >= 1 then
                                npcHandler:say('Did you bring me a red robe ?', cid)
                                talk_state = 14
                        else
                                npcHandler:say('I need a red robe, to give you a red piece of cloth. Come back when you have it.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 14 then
                        talk_state = 0
                        if getPlayerItemCount(cid,2655) >= 1 then
                                if doPlayerRemoveItem(cid,2655,1) == TRUE then
                                                doPlayerAddItem(cid,5911,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end
                elseif msgcontains(msg, 'mermaid comb') then
                        if getPlayerItemCount(cid,5480) >= 1 then
                                npcHandler:say('Did you bring me a cat\'s paw ?', cid)
                                talk_state = 15
                        else
                                npcHandler:say('I need a cat\'s paw, to give you a mermaid comb. Come back when you have it.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 15 then
                        talk_state = 0
                        if getPlayerItemCount(cid,5480) >= 1 then
                                if doPlayerRemoveItem(cid,5480,1) == TRUE then
                                                doPlayerAddItem(cid,5945,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end
                elseif msgcontains(msg, 'damaged steel helmet') then
                        if getPlayerItemCount(cid,3957) >= 51 then
                                npcHandler:say('Did you bring me a war horn ?', cid)
                                talk_state = 16
                        else
                                npcHandler:say('I need a war horn, to give you a ramsay the reckless lost helmet . Come back when you have it.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 16 then
                        talk_state = 0
                        if getPlayerItemCount(cid,3957) >= 1 then
                                if doPlayerRemoveItem(cid,3957,1) == TRUE then
                                                doPlayerAddItem(cid,5924,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end
                elseif msgcontains(msg, 'obsidian knife') then
                        if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
                                npcHandler:say('Did you bring me a piece of draconian steel and an obsidian lance ?', cid)
                                talk_state = 17
                        else
                                npcHandler:say('I need a war horn, to give you an obsidian knife . Come back when you have it.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 17 then
                        talk_state = 0
                        if getPlayerItemCount(cid,5889) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
                                if doPlayerRemoveItem(cid,5889,1) == TRUE and doPlayerRemoveItem(cid,2425,1) == TRUE then
                                                doPlayerAddItem(cid,5924,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end
                elseif msgcontains(msg, 'ceiron\'s wolf tooth chain') then
                        if getPlayerItemCount(cid,5908) >= 5 then
                                npcHandler:say('Did you bring me 10 demon horns ?', cid)
                                talk_state = 18
                        else
                                npcHandler:say('I need 10 demon horns, to give a ceiron\'s wolf tooth chain. Come back when you have them.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 18 then
                        talk_state = 0
                        if getPlayerItemCount(cid,5954) >= 10 then
                                if doPlayerRemoveItem(cid,5954,10) == TRUE then
                                                doPlayerAddItem(cid,5940,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end
                elseif msgcontains(msg, 'blessed wooden stake') then
                        if getPlayerItemCount(cid,5921) >= 10 then
                                npcHandler:say('Did you bring me 10 heaven blossoms ?', cid)
                                talk_state = 18
                        else
                                npcHandler:say('I need 10 heaven blossoms, to give a blessed wooden stake. Come back when you have them.', cid)
                                talk_state = 0
                        end
                elseif msgcontains(msg, 'yes') and talk_state == 19 then
                        talk_state = 0
                        if getPlayerItemCount(cid,5921) >= 1 then
                                if doPlayerRemoveItem(cid,5921,1) == TRUE then
                                                doPlayerAddItem(cid,5942,1)
                                                                                npcHandler:say(done, cid)
                                        end

                        else
                                npcHandler:say(item, cid)
                        end



        elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 18) then
            npcHandler:say('Ok then.')
            talk_state = 0
        end
    -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
    return true
end

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

Regards,
Shawak
 
Back
Top