Guest User

Untitled

a guest
Jul 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5. local Topic = {}
  6. local storage = 8647
  7.  
  8. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  9. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  10. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  11. function onThink() npcHandler:onThink() end
  12.  
  13. function greetCallback(cid)
  14. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  15. Topic[talkUser] = 0
  16. return true
  17. end
  18.  
  19. function creatureSayCallback(cid, type, msg)
  20.  
  21. if(not npcHandler:isFocused(cid)) then
  22. return false
  23. end
  24.  
  25. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  26. if msgcontains(msg, "yes") and Topic[talkUser] == 1 and getPlayerStorageValue(cid, storage) < 1 then
  27. npcHandler:say("I grant you ze permizzion to enter ze arena. Remember, you'll have to enter ze arena az a team of two. If you are not familiar wiz ze rulez, I can explain zem to you once again. ")
  28. setPlayerStorageValue(cid, storage, 1)
  29. Topic[talkUser] = 0
  30. elseif msgcontains(msg, "battle") and getPlayerStorageValue(cid, storage) < 1 then
  31. npcHandler:say("Zo you want to enter ze arena, you know ze rulez and zat zere will be no ozer option zan deaz or victory?")
  32. Topic[talkUser] = 1
  33. elseif msgcontains(msg, "tournament") or msgcontains(msg, "arena") then
  34. selfSay("Ze tournament iz ze ultimate challenge of might and prowrezz. Ze rulez may have changed over ze centuriez but ze ezzence remained ze zame. ...", nil, false)
  35. selfSay("If you know ze rulez, you might enter ze arena for ze battle.", nil, true)
  36. Topic[talkUser] = 0
  37. elseif msgcontains(msg, "rulez") then
  38. selfSay("I waz informed zat you were zent to fight for one of ze mozt preztigiouz officialz of ze court. According to ze rulez, ziz zponzorzhip allowz you to participate in ze tournament. ...", nil, false)
  39. selfSay("While in ze pazt, ze tournament waz ztrictly non-leazal, ze ztakez have raized conziderably nowadayz. Zo lizten clozely: You will enter ze tornament az a team! ...", nil, false)
  40. selfSay("Two of you muzt have gotten ze permizzion to enter ze arena. Zen you have to ztand on ze platformz in ze back and one of you haz to pull ze lever. You will be tranzported into ze arena. ...", nil, false)
  41. selfSay("Once you enter, zere will only be victory or deaz! You have to be aware zat zere will be no chance to flee ze combat! Firzt you will face one team of opponentz. ...", nil, false)
  42. selfSay("You don't have long to defeat zem becauze zoon anozer team will enter ze fight. Az outziderz you will certainly be ze target of zeir concentrated attackz, zo it iz advizable to get rid of your opponentz az quickly az pozzible. ...", nil, false)
  43. selfSay("You might even gain zome time to regroup and tend your woundz if you are quick. After fighting zix teamz, you will have to face ze current champion of ze arena of ztrive. ...", nil, false)
  44. selfSay("If you manage to defeat him, your mazter winz ze tournament and all honourz. Zo if you feel prepared for ze battle, you can azk me to enter ze arena any time.", nil, false)
  45. Topic[talkUser] = 0
  46. end
  47. return TRUE
  48. end
  49.  
  50. npcHandler:setMessage(MESSAGE_GREET, "Greetingz, competitor.")
  51. npcHandler:setCallback(CALLBACK_GREET, greetCallback)
  52. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  53. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment