Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <mod name="Booster De Exp" version="1.0" author="none" contact="none.com" enabled="yes">
  3. <config name="exppotion"><![CDATA[
  4. exp_info = {rate = 1, storage = {354870,354871,354872}, minutes = 120} -- rate 1 eh 50%
  5. function convertTime(a)
  6. if(type(tonumber(a)) == "number" and a > 0) then
  7. if (a <= 3599) then
  8. local minute = math.floor(a/60)
  9. local second = a - (60 * minute)
  10. if(second == 0) then
  11. return ((minute)..((minute > 1) and " minutos" or " minuto"))
  12. else
  13. return ((minute ~= 0) and ((minute>1) and minute.." minutos e " or minute.." minuto e ").. ((second>1) and second.." segundos" or second.." segundo") or ((second>1) and second.." segundos" or second.. " segundo"))
  14. end
  15. else
  16. local hour = math.floor(a/3600)
  17. local minute = math.floor((a - (hour * 3600))/60)
  18. local second = (a - (3600 * hour) - (minute * 60))
  19. if (minute == 0 and second > 0) then
  20. return (hour..((hour > 1) and " horas e " or " hora e "))..(second..((second > 1) and " segundos" or " segundo"))
  21. elseif (second == 0 and minute > 0) then
  22. return (hour..((hour > 1) and " horas e " or " hora e "))..(minute..((minute > 1) and " minutos" or " minuto"))
  23. elseif (second == 0 and minute == 0) then
  24. return (hour..((hour > 1) and " horas" or " hora"))
  25. end
  26. return (hour..((hour > 1) and " horas, " or " hora, "))..(minute..((minute > 1) and " minutos e " or " minuto e "))..(second..((second > 1) and " segundos" or " segundo"))
  27. end
  28. end
  29. end
  30. ]]></config>
  31. <event type="login" name="ExpPotionLogin" event="script"><![CDATA[
  32. domodlib('exppotion')
  33. function onLogin(cid)
  34. if getPlayerStorageValue(cid, exp_info.storage[1]) - os.time() > 0 then
  35. registerCreatureEvent(cid, "ExpPotionThink")
  36. local rates = getPlayerRates(cid)
  37. doCreatureSay(cid, "Voce ainda tem "..convertTime(getPlayerStorageValue(cid, exp_info.storage[1]) - os.time()).." de Booster De Exp", TALKTYPE_ORANGE_1, true, cid)
  38. doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+exp_info.rate)
  39. setPlayerStorageValue(cid, exp_info.storage[3], 1) -- registro
  40. end
  41. return true
  42. end]]></event>
  43. <event type="think" name="ExpPotionThink" event="script"><![CDATA[
  44. domodlib('exppotion')
  45. function onThink(cid, interval)
  46. if getPlayerStorageValue(cid, exp_info.storage[3]) > 0 and getPlayerStorageValue(cid, exp_info.storage[1]) - os.time() <= 0 then
  47. doCreatureSay(cid, "Seu booster de exp acabou!", TALKTYPE_ORANGE_1, true, cid)
  48. doPlayerSetExperienceRate(cid, getPlayerStorageValue(cid, exp_info.storage[2]))
  49. setPlayerStorageValue(cid, exp_info.storage[3], 0) -- registro
  50. end
  51. return true
  52. end]]></event>
  53. <talkaction words="!boosterexp" event="buffer"><![CDATA[
  54. domodlib('exppotion')
  55. return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,getPlayerStorageValue(cid, exp_info.storage[1]) - os.time() <= 0 and "Nenhum Booster De Exp ativa" or "Voce tem "..convertTime(getPlayerStorageValue(cid, exp_info.storage[1]) - os.time()).." de Booster De Exp")]]></talkaction>
  56. <action itemid="15876" event="script"><![CDATA[
  57. domodlib('exppotion')
  58. function onUse(cid, item, fromPosition, itemEx, toPosition)
  59. if getPlayerStorageValue(cid, exp_info.storage[1]) - os.time() > 0 then
  60. doCreatureSay(cid, "Voce ainda tem "..convertTime(getPlayerStorageValue(cid, exp_info.storage[1]) - os.time()).." de Booster De Exp", TALKTYPE_ORANGE_1, true, cid) return true
  61. end
  62. local rates = getPlayerRates(cid)
  63. setPlayerStorageValue(cid, exp_info.storage[2], rates[SKILL__LEVEL])
  64. doCreatureSay(cid, "Booster De Exp de ["..exp_info.minutes.." min] foi ativado!", TALKTYPE_ORANGE_1, true, cid)
  65. setPlayerStorageValue(cid, exp_info.storage[1], os.time()+exp_info.minutes*60)
  66. setPlayerStorageValue(cid, exp_info.storage[3], 1) -- registro
  67. doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+exp_info.rate)
  68. registerCreatureEvent(cid, "ExpPotionThink")
  69. doRemoveItem(item.uid,1)
  70. return true
  71. end]]></action>
  72. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement