Advertisement
Skymagnum

Untitled

May 12th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 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.     local destination = {x = 359, y = 1667, z = 7}
  20.  
  21.     if msgcontains(msg, 'hi') then
  22.         if getPlayerLevel(cid) > 170 then
  23.             selfSay('Olá, você quer ir para a rocket quest, fale {rocket}', cid)
  24.             talkState[talkUser] = 2
  25.         else
  26.             selfSay('Desculpe, mas somente players com level maior que 170 podem ir para lá', cid)
  27.             talkState[talkUser] = 0
  28.         end
  29.     elseif msgcontains(msg, 'rocket') and talkState[talkUser] == 2 then
  30.         selfSay('Boa viagem', cid)
  31.         doTeleportThing(cid, destination)
  32.         talkState[talkUser] = 0
  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
Advertisement