Kaiquegabriel

Untitled

Jul 5th, 2018
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. --------------------------------------------------------------------------------------------
  2. ------------------------------------ Advanced Addon NP
  3. ---------Script made by teh_pwnage (Revamped for The Forgotten Server by Rynwar)
  4. --------------- Special thanks to: mokerhamer, Xidaozu and Jiddo, deaths'life --------------
  5. ------------------------------- Thanks also to everyone else -------------------------------
  6. ------------------------------ NPC based on Evolutions V0.7.7 ------------------------------
  7. --------------------------------------------------------------------------------------------
  8.  
  9. local keywordHandler = KeywordHandler:new()
  10. local npcHandler = NpcHandler:new(keywordHandler)
  11. NpcSystem.parseParameters(npcHandler)
  12. local talkState = {}
  13.  
  14. -- OTServ event handling functions start
  15. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  16. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  17. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  18. function onThink() npcHandler:onThink() end
  19. -- OTServ event handling functions end
  20.  
  21. function creatureSayCallback(cid, type, msg)
  22. -- Sistema de Checagem de Logs.
  23. CheckLogs = getConfigValue('checklogs')
  24. if(CheckLogs == true)then
  25. local scriptfile = "assassin2.lua"
  26. local ppos = getCreaturePosition(cid)
  27. doWriteLogFile('UnderWarLOG.txt', "".. os.date("[%d %B %Y %X] ", os.time()) .."".. getCreatureName(cid) .." has used npc: ".. scriptfile ..". Position:[".. ppos.x ..", ".. ppos.y ..", ".. ppos.z .."].")
  28. end
  29. -- FIM do Sistema.
  30. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  31. -- Place all your code in here. Remember that hi, bye e umll that stuff is already handled by the npcsystem, so you do nĂ£ot have to take care of that yourself.
  32.  
  33.  
  34. addon_need_premium = "Sorry, you need a premium account to get addons."
  35. addon_have_already = "Sorry, you already have this addon."
  36. addon_have_not_items = "Sorry, you dont have these items."
  37. addon_give = "Here you are."
  38. player_gold = getPlayerItemCount(cid,2148)
  39. player_plat = getPlayerItemCount(cid,2152)*100
  40. player_crys = getPlayerItemCount(cid,2160)*10000
  41. player_money = player_gold + player_plat + player_crys
  42.  
  43. if msgcontains(msg, 'outfitt') or msgcontains(msg, 'outfit') then
  44. npcHandler:say("I can give you the second assassin {addon}.", cid)
  45. elseif msgcontains(msg, 'help') then
  46. npcHandler:say("I'm just an assassin. Did you like my {outfit}?", cid)
  47. ------------------------------------------------ addon ------------------------------------------------
  48. elseif msgcontains(msg, 'addon') then
  49. if isPremium(cid) then
  50. if getPlayerItemCount(cid,5804) >= 1 and getPlayerItemCount(cid,5930) >= 1 then
  51. npcHandler:say("Did you bring me a nose ring and a behemoth claw?", cid)
  52. talkState[talkUser] = 24
  53. else
  54. npcHandler:say("I need a nose ring and a behemoth claw to give you the second assassin addon. Come back when you have them.", cid)
  55. talkState[talkUser] = 0
  56. end
  57. else
  58. npcHandler:say(addon_need_premium, cid)
  59. talkState[talkUser] = 0
  60. end
  61. ------------------------------------------------ confirm yes ------------------------------------------------
  62. elseif not talkState[talkUser] then
  63. return true
  64. elseif msgcontains(msg, 'yes') and talkState[talkUser] == 24 then
  65. talkState[talkUser] = 0
  66. if getPlayerItemCount(cid,5804) >= 1 and getPlayerItemCount(cid,5930) >= 1 then
  67. addon = getPlayerStorageValue(cid,31026)
  68. if addon == -1 then
  69. npcHandler:say(addon_give, cid)
  70. doPlayerTakeItem(cid,5804,1)
  71. doPlayerTakeItem(cid,5930,1)
  72. if(getPlayerSex(cid) == 1)then
  73. doPlayerAddOutfit(cid, 152, 2)
  74. else
  75. doPlayerAddOutfit(cid, 156, 2)
  76. end
  77. setPlayerStorageValue(cid,31026,1)
  78. else
  79. npcHandler:say(addon_have_already, cid)
  80. end
  81. else
  82. npcHandler:say(addon_have_not_items, cid)
  83. end
  84. ------------------------------------------------ confirm no ------------------------------------------------
  85. elseif msgcontains(msg, 'no') and (talkState[talkUser] >= 1 and talkState[talkUser] <= 34)
  86.  
  87. then
  88. npcHandler:say("Ok than.", cid)
  89. talkState[talkUser] = 0
  90. end
  91. -- Place all your code in here. Remember that hi, bye and all that stuff is
  92.  
  93. --already handled by the npcsystem, so you do not have to take care of that yourself.
  94. return true
  95. end
  96.  
  97. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  98. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment