Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4. local talkState = {}
  5. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  6. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  7. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  8. function onThink() npcHandler:onThink() end
  9. function creatureSayCallback(cid, type, msg)
  10. if(not npcHandler:isFocused(cid)) then
  11. return false
  12. end
  13. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  14.  
  15.  
  16.  
  17. if (msgcontains(msg, 'aguas') or msgcontains(msg, 'AGUAS')) then
  18. selfSay('Voce deseja ir para as aguas termais?, digite {yes} irá custar '.. gold..'', cid)
  19. talkState[talkUser] = 1
  20. if (msgcontains(msg, 'yes') and talkState[talkUser] == 1) and (getPlayerBalance(cid) >= gold) then
  21. doPlayerSetBalance(cid, (getPlayerBalance(cid)-gold))
  22. doTeleportThing(cid, {x = 1012, y = 908, z = 4}) -- localcidade de tp
  23. selfSay("Você foi parar nas Aguas termais...",cid)
  24. talkState[talkUser] = 0
  25. else
  26. selfSay("Safado, você não tem o "..gold.."",cid)
  27. talkState[talkUser] = 0
  28. end
  29. elseif msg == "no" and talkState[talkUser] >= 1 then
  30. selfSay("Then not", cid)
  31. talkState[talkUser] = 0
  32. npcHandler:releaseFocus(cid)
  33. end
  34. return TRUE
  35. end
  36. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  37. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement