Advertisement
Guest User

Colin.lua

a guest
Jul 5th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 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. local voices = {
  11.     { text = 'Welcome to the post office!' },
  12.     { text = 'If you need help with letters or parcels, just ask me. I can explain everything.' },
  13.     { text = 'Hey, send a letter to your friend now and then. Keep in touch, you know.' }
  14. }
  15. npcHandler:addModule(VoiceModule:new(voices))
  16.  
  17. local function creatureSayCallback(cid, type, msg)
  18.     if not npcHandler:isFocused(cid) then
  19.         return false
  20.     end
  21.     if msgcontains(msg, "measurements") then
  22.         local player = Player(cid)
  23.         if player:getStorageValue(Storage.postman.Mission07) >= 1 then
  24.             npcHandler:say("Oh they don't change that much since in the old days as... <tells a boring and confusing story about a cake, a parcel, himself and two squirrels, at least he tells you his measurements in the end> ", cid)
  25.             player:setStorageValue(Storage.postman.Mission07, player:getStorageValue(Storage.postman.Mission07) + 1)
  26.             npcHandler.topic[cid] = 0
  27.         end
  28.     end
  29.     return true
  30. end
  31. local language = getAccountLanguage(cid)
  32.     if language == ENGLISH then
  33.     colg = 'Hello. How may I help you |PLAYERNAME|? Ask me for a {trade} if you want to buy something. I can also explain the {mail} system.'
  34.     colf = 'It was a pleasure to help you, |PLAYERNAME|.'
  35.     elseif language == POLISH then
  36.     colg = 'Witaj. |PLAYERNAME|, jak moge Ci pomoc? Zapytaj mnie o {trade} jesli chcesz cos kupic. Moge ci tez wyjasnic {mail} system.'
  37.     colf = 'To byla przyjemnosc, aby Ci pomoc, |PLAYERNAME|.'
  38.     end
  39.  
  40.     npcHandler:setMessage(MESSAGE_GREET, colg)
  41.     npcHandler:setMessage(MESSAGE_FAREWELL, colf)
  42.  
  43.  
  44. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  45. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement