alexmoretoni

Untitled

Dec 5th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. local keywordHandler = KeywordHandler:new()
  2. local npcHandler = NpcHandler:new(keywordHandler)
  3. NpcSystem.parseParameters(npcHandler)
  4.  
  5.  
  6. function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
  7. function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
  8. function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
  9. function onThink() npcHandler:onThink() end
  10.  
  11. function creatureSayCallback(cid, type, msg)
  12. if(not npcHandler:isFocused(cid)) then
  13. return false
  14. end
  15.  
  16.  
  17. if msgcontains(msg, "promot") then
  18. npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
  19. Topic[talkUser] = 1
  20. elseif msgcontains(msg, "yes") and Topic[talkUser] == 1 then
  21. if(getPlayerStorageValue(cid, 30018) == 1) then
  22. npcHandler:say('You are already promoted.', cid)
  23. elseif(getPlayerLevel(cid) < 20) then
  24. npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
  25. elseif getPlayerMoney(cid) < 20000 then
  26. npcHandler:say('You do not have enough money.', cid)
  27. elseif getConfigInfo("freePremium") == "yes" or isPremium(cid) == TRUE then
  28. npcHandler:say("Congratulations! You are now promoted. You have learned new spells.", cid)
  29. local promotedVoc = getPromotedVocation(getPlayerVocation(cid))
  30. doPlayerSetVocation(cid, promotedVoc)
  31. doPlayerRemoveMoney(cid, 20000)
  32. else
  33. npcHandler:say("You need a premium account in order to promote.", cid)
  34. end
  35. Topic[talkUser] = 0
  36. end
  37. return true
  38. end
  39.  
  40. npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
  41. npcHandler:addModule(FocusModule:new())
Add Comment
Please, Sign In to add comment