Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  6. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  7. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  8. function onThink() npcHandler:onThink() end
  9.  
  10. function creatureSayCallback(cid, type, msg)
  11. if (npcHandler.focus ~= cid) then
  12. return false
  13. end
  14.  
  15. if msgcontains(msg, 'pick') then
  16. npcHandler:say('Picks are hard to come by. I trade them only for high quality small axes. Do you want to trade?')
  17. talk_state = 1
  18.  
  19. elseif msgcontains(msg, 'yes') and talk_state == 1 and getPlayerItemCount(cid,2559) > 0 then
  20. doPlayerRemoveItem(cid, 2559, 1)
  21. doPlayerAddItem(cid, 2553, 1)
  22. npcHandler:say('Splendid! Here take your pickaxe.')
  23. talk_state = 0
  24.  
  25. elseif msgcontains(msg, 'yes') and talk_state == 1 and getPlayerItemCount(cid,2559) == 0 then
  26. npcHandler:say('You don\'t have a small axe.')
  27. talk_state = 0
  28.  
  29. elseif msgcontains(msg, 'no') and talk_state == 1 and getPlayerItemCount(cid,2559) == 0 then
  30. npcHandler:say('Okay then.')
  31. talk_state = 0
  32.  
  33.  
  34.  
  35.  
  36. end
  37. end
  38.  
  39. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  40. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement