skydangerous

Untitled

Nov 18th, 2011
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.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.         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 money = getPlayerItemCount(cid,2160)*10
  19.        local pos = {x=1012,y=1014,z=7}
  20.         local pos1 = getCreaturePosition(cid)
  21.        
  22.         if msgcontains(msg, 'primeira fase') or msgcontains (msg, 'first') then
  23.                              selfSay('Voce quer participar da primeira fase?')
  24.                                talkState[talkUser] = 1
  25.                    
  26.  
  27.         elseif talkState[talkUser] == 1 then
  28.                 if msgcontains(msg, 'yes') then
  29.                                 selfSay('Bora jogar !.', cid)
  30.                                doTeleportThing(cid,pos)
  31.                   doPlayerSendTextMessage(cid,21,"Boa-Sorte a primeira fase")  
  32.         doSendMagicEffect(pos1,2)
  33.             talkState[talkUser] = 0
  34.  
  35.      elseif msgcontains(msg, 'segunda fase') or msgcontains (msg, 'segunda') then
  36.                       if getPlayerStorageValue(uid, 210000) then
  37.              selfSay('Voce quer participar da segunda fase?')
  38.                                talkState[talkUser] = 2
  39.       else
  40.          selfSay('Voce nao completou a primeira fase', cid)
  41.             talkState[talkUser] = 0
  42.     end
  43.  
  44.       elseif talkState[talkUser] == 2 then
  45.                 if msgcontains(msg, 'yes') then            
  46.                                 selfSay('Bora jogar !.', cid)
  47.                                   doPlayerSendTextMessage(cid,21,"Boa-Sorte a segunda fase")  
  48.                                   talkState[talkUser] = 2  
  49.      end
  50.         return true
  51. end
  52.    end
  53.    end
  54.    
  55.  
  56. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  57. npcHandler:addModule(FocusModule:new())
  58.  
Advertisement
Add Comment
Please, Sign In to add comment