Advertisement
CREAMPAN0408

Untitled

Feb 22nd, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. options:
  2. ActionBars: true #Enable/disable action bars!#
  3. CountdownStart: &7A countdown has begun! #The message that is sent when a countdown begins.#
  4. CountdownMsg: &7{TIME} #This is the format of time that will be sent in a countdown time message.#
  5. CountdownEnd: &7The countdown has ended! #This message will be sent when a countdown ends.#
  6. NoTimeSet: &7Please specify some seconds. #This is sent if a user does not enter a valid time input when creating a countdown.#
  7. NoPermMsg: &7No Permission! #This is sent if a user does NOT have permission for a command.#
  8. Prefix: &8[&6Countdown&8] &7 #This is the prefix of the Script.#
  9. Permission: countdowncommand.use #This is the permission of the Script command.#
  10. Titles: true #Set to true to enable Titles (BETA!)#
  11. TopTitleLine: &cNotice! #Set the top line of a title to something!#
  12. UpdaterPermission: countdowncommand.updater #Permission to use the /countdownupdater command!#
  13.  
  14. #---------------------------#
  15. # NOTICE! #
  16. # ^^^^ ^^^^ #
  17. # IF YOU DO NOT KNOW WHAT #
  18. # YOU ARE DOING THEN DO NOT #
  19. # EDIT THE SKRIPT BEYOND #
  20. # THIS POINT! #
  21. #---------------------------#
  22.  
  23. function updateChecker(n: number):
  24. set {_cdver} to line 1 from url "https://api.spigotmc.org/legacy/update.php?resource=25402/" parsed as a number
  25. set {_cdv} to "%{cdversion}%" parsed as a number
  26. if {_cdver} is equal to {_cdv}:
  27. message "&8[&6Countdown&8] &7Successfully loaded the latest version of &6Countdown &8v&a%{cdversion}%&7." to console
  28. else if {_cdv} is greater than {_cdver}:
  29. send "&8[&6Countdown&8] &7Either you're running a beta version or you changed the version number! (&8v&a%{cdversion}%&7)" to console
  30. else:
  31. send "&8[&6Countdown&8] &7An update is available! (&a%{_cdv}% &7-> &a%{_cdver}%&7)" to console
  32. send "&8[&6Countdown&8] &7Download it here: &fhttp://bit.ly/2kFm4jN" to console
  33.  
  34. function updateCheckerCmd(p: player):
  35. set {_cdver} to line 1 from url "https://api.spigotmc.org/legacy/update.php?resource=25402/" parsed as a number
  36. set {_cdv} to "%{cdversion}%" parsed as a number
  37. if {_cdver} is equal to {_cdv}:
  38. send "&8[&6Countdown&8] &7You are currently running the latest version of &6Countdown &8v&a%{cdversion}%&7." to {_p}
  39. else if {_cdv} is greater than {_cdver}:
  40. send "&8[&6Countdown&8] &7Either you're running a beta version or you changed the version number! (&8v&a%{cdversion}%&7)" to {_p}
  41. else:
  42. send "&8[&6Countdown&8] &7An update is available! (&a%{_cdv}% &7-> &a%{_cdver}%&7)" to {_p}
  43. send "&8[&6Countdown&8] &7Download it here: &fhttp://bit.ly/2kFm4jN" to {_p}
  44.  
  45. function countDown(t: integer, p: player, g: text):
  46. set {_m} to "{@CountdownMsg}"
  47. set {cmd} to {_g}
  48. loop {_t} times:
  49. if {timer} is true:
  50. if {@Titles} is true:
  51. send all players title "{@TopTitleLine}" with subtitle "%{_t}%" for 1 seconds
  52. if {@ActionBars} is true:
  53. set action bar of {_p} to "&6Countdown: &7%{_t}%"
  54. wait 1 seconds
  55. remove 1 from {_t}
  56. set {cd} to {_t}
  57. broadcast "{@Prefix}%{_t}%"
  58. if {_t} = 0:
  59. delete {cd}
  60. if {_g} is set:
  61. execute console command {_g}
  62. delete {cmd}
  63. broadcast "{@Prefix}{@CountdownEnd}"
  64. command /countdown [<integer>] [<text>]:
  65. permission message: {@NoPermMsg}
  66. permission: {@Permission}
  67. trigger:
  68. if arg 1 is set:
  69. if arg 1 is "0" parsed as an integer:
  70. if {timer} is true:
  71. set {timer} to false
  72. send "{@Prefix}Stopped the countdown"
  73. else:
  74. send "{@Prefix}There is no timer running."
  75. else:
  76. broadcast "{@Prefix}{@CountdownStart}"
  77. wait 1 seconds
  78. set {_time} to arg 1
  79. countDown(arg 1, {_p}, arg 2)
  80. set {timer} to true
  81. else if arg 1 is not set:
  82. send "{@Prefix}{@NoTimeSet}"
  83. command /countdownupdater [<text>]:
  84. permission message: {@NoPermMsg}
  85. permission: {@UpdaterPermission}
  86. trigger:
  87. if arg 1 is set:
  88. if arg 1 is "toggle":
  89. if {cdupdater} is true:
  90. set {cdupdater} to false
  91. send "{@Prefix}Successfully set the auto update checker to false."
  92. else:
  93. set {cdupdater} to true
  94. send "{@Prefix}Successfully set the auto update checker to true."
  95. else if arg 1 is "check":
  96. updateCheckerCmd(player)
  97. else:
  98. send "{@Prefix}Unknown argument."
  99. else:
  100. send "{@Prefix}Please use one of the following arguments: toggle, check"
  101. on skript load:
  102. updateChecker(1)
  103. every 5 minutes:
  104. if {cdupdater} is true:
  105. updateChecker(1)
  106. on load:
  107. set {cdversion} to "2.5"
  108. message "&8[&6Countdown&8] &7Successfully loaded &6Countdown Command&7." to console
  109. on skript load:
  110. countDown({cd}, {_p}, {cmd})
  111. on unload:
  112. message "&8[&6Countdown&8] &7Successfully unloaded &6Countdown Command&7. Goodbye!" to console
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement