local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "yes") then
local items = {1, 2, 3, 4, 5, 6, 7}
local has
for i = 1, #items do
if getPlayerItemCount(cid, items[i]) < 1 then
npcHandler:say("You dont have the required items.", cid)
break
end
has = true
end
if has then
for i = 1, #items do
doPlayerRemoveItem(cid, items[i], 1)
end
doPlayerAddItem(cid, ur_item_id, 1)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())