Advertisement
Snowsz

Untitled

Feb 1st, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. local outfitt = 6575
  4. local iteem = 2160
  5. local quatidade = 1
  6. NpcSystem.parseParameters(npcHandler)
  7. local talkState = {}
  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. function creatureSayCallback(cid, type, msg)
  13. if(not npcHandler:isFocused(cid)) then
  14. return false
  15. end
  16.  
  17.  
  18. local itemid = 22222222
  19. local count = 1
  20.  
  21. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT
  22.   if(msgcontains(msg, 'outfit')) then
  23.     selfSay('MSG1') -- Edite Sua Menssagem para quando o player falar *OUTFIT*
  24.     talkState[talkUser] = 1
  25.   elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
  26.     if (getPlayerStorageValue(cid,outfitt) > 0) then
  27.       selfSay('MSG2') -- Eite a menssagem , que se o player tentar trocar de novo , o NPC avisar que ele já fez essa missao
  28.     else
  29.       if getPlayerItemCount(cid, itemid) >= 1 then
  30.         setPlayerStorageValue(cid,outfitt,1)
  31.         doPlayerRemoveItem(cid, itemid,count)
  32.         selfSay('MSG3') -- Edite a menssagem de agradescimento
  33.       else
  34.         selfSay('MSG4') -- Edite a menssagem que o player nao tem x item
  35.       end
  36.     end
  37.   return true
  38.   end
  39. end
  40.  
  41. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  42. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement