Advertisement
Guest User

Untitled

a guest
May 30th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 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 function creatureSayCallback(cid, type, msg)
  11. if not npcHandler:isFocused(cid) then
  12. return false
  13. end
  14.  
  15. local player = Player(cid)
  16.  
  17. if msgcontains(msg, 'yes') then
  18. if(os.date("%A") == "Sunday") then
  19. if not player:removeMoney(50) then
  20. npcHandler:say('The exhibition is not for free. You have to pay 50 gold coins to get in. Next please!', cid)
  21. npcHandler:releaseFocus(cid)
  22. npcHandler:resetNpc(cid)
  23. return true
  24. end
  25. npcHandler:releaseFocus(cid)
  26. npcHandler:resetNpc(cid)
  27. else
  28. npcHandler:say('Sorry, the exhibition is only open on Sundays.', cid)
  29. npcHandler:releaseFocus(cid)
  30. npcHandler:resetNpc(cid)
  31. return true
  32. end
  33. npcHandler:say('And here we go!', cid)
  34. player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  35. local exhibitionPosition = Position(32390, 32195, 8)
  36. player:teleportTo(exhibitionPosition)
  37. exhibitionPosition:sendMagicEffect(CONST_ME_TELEPORT)
  38. else
  39. npcHandler:say('Then not.', cid)
  40. end
  41. npcHandler:releaseFocus(cid)
  42. npcHandler:resetNpc(cid)
  43. return true
  44. end
  45.  
  46. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  47. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement