Advertisement
Guest User

Untitled

a guest
May 29th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. local config = {
  2. rate = 1,
  3. storage = 41210,
  4. expstorage = 41211,
  5. register = 41212,
  6. time = 30,
  7. }
  8.  
  9. function onUse(cid, item, fromPosition, itemEx, toPosition)
  10. if getPlayerStorageValue(cid, config.storage) <= 0 then
  11. local rates = getPlayerRates(cid)
  12. setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
  13. setPlayerStorageValue(cid, config.register, 1)
  14. itemEx=itemid == 7443
  15. doCreatureSay(cid, "Você está usando double exp potion!", TALKTYPE_ORANGE_1, true, cid)
  16. setPlayerStorageValue(cid, config.storage, os.time()+config.time)
  17. doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+config.rate)
  18. doRemoveItem(item.uid,1)
  19. registerCreatureEvent(cid, "ExpStage")
  20. else
  21. doCreatureSay(cid, "Você já está usando double exp potion!", TALKTYPE_ORANGE_1, true, cid)
  22. end
  23. return true
  24. end
  25. function onThink(cid, interval)
  26. if getPlayerStorageValue(cid, config.register) == 1 then
  27. if getPlayerStorageValue(cid, config.storage) <= os.time() then
  28. doCreatureSay(cid, "A sua double exp potion encerrou!", TALKTYPE_ORANGE_1, true, cid)
  29. setPlayerStorageValue(cid, config.storage, 0)
  30. setPlayerStorageValue(cid, config.register, 0)
  31. local oldexp = getPlayerStorageValue(cid, config.expstorage)
  32. doPlayerSetExperienceRate(cid, oldexp)
  33. unregisterCreatureEvent(cid, "ExpStage")
  34. end
  35. end
  36. return true
  37. end
  38. function onLogin(cid)
  39. if getPlayerStorageValue(cid, config.register) == 1 then
  40. registerCreatureEvent(cid, "ExpStage")
  41. local rates = getPlayerRates(cid)
  42. doCreatureSay(cid, "A sua double exp potion ainda continua ativada!", TALKTYPE_ORANGE_1, true, cid)
  43. if getPlayerStorageValue(cid, config.storage) > os.time() then
  44. local oldexp = getPlayerStorageValue(cid, config.expstorage)
  45. doPlayerSetExperienceRate(cid, oldexp+config.rate)
  46. end
  47. end
  48. return true
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement