Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. local talkState = {}
  5.  
  6. function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
  7. function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
  8. function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg)        end
  9. function onThink()                  npcHandler:onThink()                    end
  10.  
  11. function creatureSayCallback(cid, type, msg)
  12. if(not npcHandler:isFocused(cid)) then
  13.     return false
  14. end
  15.  
  16. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  17.  
  18. local buff_str = 211100 -- Storage da missao dos buffs
  19. local buff = {
  20.  
  21.     health = 100, -- Vida
  22.     mana = 100, -- Mana
  23.     req_lvl = 10, -- Level necessário
  24.     req_item = 2160, -- Item necessário
  25.     storage = 23123123 -- Storage do buff
  26. }
  27.  
  28. if (msgcontains(msg, "buff")) then
  29.     if getPlayerStorageValue(cid, buff_str) >= 1 then
  30.         if getPlayerStorageValue(cid, buff.storage) <= 0 then
  31.             if getPlayerItemCount(cid, buff.req_item) >= 1 then
  32.                 if getPlayerLevel(cid) >= buff.req_lvl then
  33.                     setCreatureMaxHealth(cid, buffbuff.health)
  34.                     setCreatureMaxMana(cid, buffbuff.mana)
  35.                     doPlayerRemoveItem(cid, buffbuff.req_item, 1)
  36.                     setPlayerStorageValue(cid, buffbuff.storage, 1)
  37.                     selfSay("Voce recebeu o buff um.", cid)
  38.                 else
  39.                     selfSay("Voce precisa de no minimo level "..buff.req_lvl..".", cid)
  40.                 end
  41.             else
  42.                 selfSay("Voce nao possui 1 "..getItemNameById(buff.req_item)..".", cid)
  43.             end
  44.         else
  45.             selfSay("Voce ja adquiriu este buff uma vez.", cid)
  46.         end
  47.     else
  48.         selfSay("Voce precisa completar a missao dos buffs.", cid)
  49.     end
  50.     return true
  51. end
  52.  
  53. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  54. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement