Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- function creatureSayCallback(cid, type, msg)
- if (npcHandler.focus ~= cid) then
- return false
- end
- if msgcontains(msg, 'pick') then
- npcHandler:say('Picks are hard to come by. I trade them only for high quality small axes. Do you want to trade?')
- talk_state = 1
- elseif msgcontains(msg, 'yes') and talk_state == 1 and getPlayerItemCount(cid,2559) > 0 then
- doPlayerRemoveItem(cid, 2559, 1)
- doPlayerAddItem(cid, 2553, 1)
- npcHandler:say('Splendid! Here take your pickaxe.')
- talk_state = 0
- elseif msgcontains(msg, 'yes') and talk_state == 1 and getPlayerItemCount(cid,2559) == 0 then
- npcHandler:say('You don\'t have a small axe.')
- talk_state = 0
- elseif msgcontains(msg, 'no') and talk_state == 1 and getPlayerItemCount(cid,2559) == 0 then
- npcHandler:say('Okay then.')
- talk_state = 0
- end
- end
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement