Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1.  
  2. local keywordHandler = KeywordHandler:new()
  3. local npcHandler = NpcHandler:new(keywordHandler)
  4. NpcSystem.parseParameters(npcHandler)
  5. local talkState = {}
  6. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  7. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  8. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  9. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  10. function onThink() npcHandler:onThink() end
  11. function greetCallback(cid)
  12. talkState[talkUser] = 0
  13. return true
  14. end
  15. function creatureSayCallback(cid, type, msg)
  16. local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  17. if(not npcHandler:isFocused(cid)) then
  18. return false
  19. end
  20. local trade = {
  21. {id=1691, storage=230, name="Red"},
  22. {id=1688, storage=160, name="Green"},
  23. {id=1690, storage=160, name="Blue"},
  24. {id=1689, storage=160, name="Yellow"},
  25. {id=1692, storage=160, name="Violet"},
  26. }
  27. local items = {}
  28. for _, item in ipairs(trade) do
  29. items[item.id] = {item_id = item.id, realName = item.name}
  30. end
  31. local onBuy = function(cid, item, amount, ignoreCap, inBackpacks)
  32. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE , "Kupiles "..items[item].realName.." Aura.")
  33. setPlayerStorageValue(cid,trade.storage,1)
  34. end
  35. if msgcontains(msg, 'Aura') or msgcontains(msg, 'Effects') then
  36. openShopWindow(cid, trade, onBuy, onSell)
  37. selfSay("Co dzis zaczarujesz?", cid)
  38. end
  39. return true
  40. end
  41. npcHandler:setMessage(MESSAGE_WALKAWAY, "Do zobaczenia!")
  42. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  43. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement