Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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. local storage = 10001
  11.  
  12. function creatureSayCallback(cid, type, msg)
  13. if (npcHandler.focus ~= cid) then
  14. return false
  15. end
  16.  
  17. if msgcontains(msg, 'hi') then
  18. if getPlayerStorageValue(cid, 1) == 1 then
  19. npcHandler:say('Hello')
  20. talk_state = 1
  21. else
  22. npcHandler:say('Fuck off')
  23. end
  24. elseif msgcontains(msg, 'djanni\'hah') then
  25. npcHandler:say('Splendid! Here take your pickaxe.')
  26. talk_state = 1
  27. elseif msgcontains(msg, 'mission') and talk_state == 1 then
  28. npcHandler:say('you want a mission?')
  29. talk_state = 2
  30. elseif msgcontains(msg, 'yes') and talk_state == 2 then
  31. npcHandler:say('Okay then.')
  32. talk_state = 3
  33. end
  34. end
  35.  
  36. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  37. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement