Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  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.  
  10. function creatureSayCallback(cid, type, msg)
  11. if (npcHandler.focus ~= cid) then
  12. if msg == "hi" or msg == "hello" then
  13. if getPlayerStorageValue(cid, 59200) == -1 then
  14. npcHandler:say('random shit 1')
  15. talk_state = 1
  16. elseif getPlayerStorageValue(cid, 59200) == 1 then
  17. npcHandler:say('random shit 2')
  18. talk_state = 1
  19. else
  20. npcHandler:say('random shit 3')
  21. end
  22. NpcHandler:changeFocus(cid)
  23. else
  24. return false
  25. end
  26.  
  27. elseif msgcontains(msg, "no") and talk_state == 1 then
  28. npcHandler:say('Fuck off.')
  29. talk_state = 0
  30. elseif msgcontains(msg, "bye") then
  31. npcHandler:say('Bye.')
  32. npcHandler:releaseFocus(cid)
  33. end
  34. return true
  35. end
  36.  
  37. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement