Advertisement
Guest User

Untitled

a guest
May 23rd, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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 function creatureSayCallback(cid, type, msg)
  11. if not npcHandler:isFocused(cid) then
  12. return false
  13. end
  14. local player = Player(cid)
  15. if isInArray({"soft boots", "repair", "soft", "boots"}, msg) then
  16. npcHandler:say("Do you want to repair your worn soft boots for 10000 gold coins?", cid)
  17. npcHandler.topic[cid] = 1
  18. elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
  19. npcHandler.topic[cid] = 0
  20. if player:getItemCount(10021) == 0 then
  21. npcHandler:say("Sorry, you don't have the item.", cid)
  22. return true
  23. end
  24.  
  25. if not player:removeMoney(10000) then
  26. npcHandler:say("Sorry, you don't have enough gold.", cid)
  27. return true
  28. end
  29.  
  30. player:removeItem(10021, 1)
  31. player:addItem(6132, 1)
  32. npcHandler:say("Here you are.", cid)
  33. elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
  34. npcHandler.topic[cid] = 0
  35. npcHandler:say("Ok then.", cid)
  36.  
  37.  
  38. end
  39.  
  40. return true
  41. end
  42.  
  43. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  44. npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement