Skymagnum

Untitled

May 12th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 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.  
  13.     if(not npcHandler:isFocused(cid)) then
  14.         return false
  15.     end
  16.  
  17. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  18.  
  19.     if msgcontains(msg, 'hi') then
  20.         if getPlayerLevel(cid) < 150 then
  21.             if getPlayerStorageValue(cid, 897538) < 1 then
  22.                 selfSay('Pronto, você ganhou seu storage', cid)
  23.                 talkState[talkUser] = 1
  24.                 setPlayerStorageValue(cid, 897538, 1)
  25.             else
  26.                 selfSay('Você não pode pegar a storage novamente.', cid)
  27.                 talkState[talkUser] = 0
  28.             end
  29.         else
  30.             selfSay('Você precisa ser level 150 no mínimo para pegar a storage', cid)
  31.             talkState[talkUser] = 0
  32.         end
  33.     end
  34.  
  35.     return true
  36. end
  37.  
  38. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  39. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment