Advertisement
fleft17

Untitled

Aug 4th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.13 KB | None | 0 0
  1. # Timer Skript by D4mnX
  2.  
  3. # Legaldog: I PROVIDE NO RESPONSIBILITY FOR ANY DAMAGES THAT RESULT DUE TO USAGE OF THIS SKRIPT. USE AT YOUR OWN RISK.
  4. # Legaldog OUT
  5.  
  6. options:
  7. # Prefix of broadcast timer messages
  8. TimerBC : &8[&bFavonius&8]&r
  9.  
  10. # Prefix of all OP messages
  11. TimerOP : &8[&bFavonius&8]&r
  12.  
  13.  
  14. UseInternalCommands : true
  15.  
  16. # Check frequency, in ticks.
  17. CheckFrequency : 40
  18.  
  19.  
  20. # Command to start the timer
  21. command /timer-start [<integer=90>] [<integer=20>]:
  22. description: Starts the timer
  23. usage: /timer-start <Min. until Meetup> [<Min. Until PvP>]
  24. permission: skript.timer.start
  25. trigger:
  26. set {_LocalTime} to now
  27.  
  28. # Timer already running?
  29. if {Timer.Running} is true:
  30. message "{@TimerOP} The Timer is already running!"
  31. stop trigger
  32.  
  33. # No negative times
  34. if arg 1 is less than 1:
  35. message "{@TimerOP} Please enter a positive time!"
  36. stop trigger
  37.  
  38. # Check if the broadcast array exists
  39. if {Timer.Array::*} is not set:
  40. message "{@TimerOP} eWARNING&r: No broadcast array found!"
  41. message "{@TimerOP} Using the default array."
  42. execute console command "/timer-array-reset"
  43.  
  44. # Initialize variables
  45. set {Timer.Running} to true
  46. set {Timer.StartTime} to {_LocalTime}
  47. set {Timer.MinutesPassed} to 0
  48. set {Timer.MeetupAt} to arg 1
  49. set {Timer.TimeTilPvP} to arg 2
  50. execute console command "/scoreboard players reset &c&oMeetup"
  51. execute console command "/scoreboard players reset &b&oPvP"
  52.  
  53. # Broadcast the timer has started
  54. broadcast "{@TimerBC} &e%{Timer.MeetupAt}% &rminutes&r remain until &cMeetup!"
  55.  
  56. # PvP Stuff
  57. if arg 2 is set:
  58. if {Timer.Mole} is not set:
  59. broadcast "{@TimerBC} &cPvP &rwill be enabled in &e%arg 2% &rminutes!"
  60. if {Timer.Mole} is true:
  61. broadcast "{@TimerBC} &cPvP&r/&cMoles &rin &c%arg 2% &rminutes!"
  62. set {Timer.PvPCheck} to true
  63. set {Timer.PvPAt} to arg 2
  64.  
  65.  
  66. {Timeboard.enabled} is set:
  67. execute console command "/scoreboard players set &c&oMeetup &7>&9UHC&7< %{Timer.MeetupAt}%"
  68.  
  69. execute console command "/scoreboard players set &b&oPvP &7>&9UHC&7< %{Timer.PvPAt}%"
  70.  
  71. # Message OPs who started a timer
  72.  
  73.  
  74.  
  75.  
  76.  
  77. command /timer-stop:
  78. description: Stops the timer
  79. usage: /timer-stop
  80. permission: skript.timer.stop
  81. trigger:
  82. # Timer even running?
  83. if {Timer.Running} is not set:
  84. message "{@TimerOP} The timer is not running!"
  85. stop trigger
  86.  
  87. # Delete variables
  88. delete {Timer.Running}
  89. delete {Timer.StartTime}
  90. delete {Timer.MinutesPassed}
  91. delete {Timer.MeetupAt}
  92. delete {Timer.PvPCheck}
  93. delete {Timer.PvPAt}
  94. delete {Timer.PauseTime}
  95. execute console command "/scoreboard players reset &c&oMeetup"
  96. execute console command "/scoreboard players reset &b&oPvP"
  97.  
  98. # Broadcast the stopping of the timer
  99. broadcast "{@TimerBC} The timer has stopped."
  100.  
  101. # Message OPs who stopped the timer.
  102. if command sender is not the console:
  103. loop all players:
  104. loop-player has the permission "skript.timer.stop.notify"
  105. loop-player is not the command sender
  106. message "{@TimerOP} &e%command sender% &rstopped the timer&7." to loop-player
  107.  
  108.  
  109. command /timer-pause:
  110. description: Pause the timer
  111. usage: /timer-pause
  112. permission: skript.timer.pause
  113. trigger:
  114. set {_LocalTime} to now
  115.  
  116. # Timer even running?
  117. if {Timer.Running} is not set:
  118. message "{@TimerOP} The Timer is not running!"
  119. stop trigger
  120.  
  121. # Timer already paused?
  122. if {Timer.Paused} is true:
  123. message "{@TimerOP} The Timer is already paused!"
  124. stop trigger
  125.  
  126. set {Timer.Paused} to true
  127. set {Timer.PauseTime} to {_LocalTime}
  128.  
  129. # Broadcast the pausing of the timer
  130. broadcast "{@TimerBC} The Timer has been paused!"
  131.  
  132. # Message OPs who paused the timer
  133. if command sender is not the console:
  134. loop all players:
  135. loop-player has the permission "skript.timer.pause.notify"
  136. loop-player is not the command sender
  137. message "{@TimerOP} &e%command sender% &rpaused the timer." to loop-player
  138.  
  139.  
  140. command /timer-resume:
  141. description: Resume the timer
  142. usage: /timer-resume
  143. permission: skript.timer.resume
  144. trigger:
  145. set {_LocalTime} to now
  146.  
  147. if {Timer.Paused} is not set:
  148. message "{@TimerOP} The Timer is not paused!"
  149. stop trigger
  150.  
  151. # Fixing the start time by adding the time the timer was paused
  152. set {_Difference} to difference between {Timer.PauseTime} and {_LocalTime}
  153. set {Timer.StartTime} to {Timer.StartTime}+{_Difference}
  154.  
  155. # Deleting the unnecessary variables
  156. delete {Timer.Paused}
  157. delete {Timer.PauseTime}
  158.  
  159. # Broadcast the resuming of the timer
  160. broadcast "{@TimerBC} The Timer has been resumed!"
  161.  
  162. # Message OPs who resumed the timer
  163. if command sender is not the console:
  164. loop all players:
  165. loop-player has the permission "skript.timer.resume.notify"
  166. loop-player is not the command sender
  167. message "{@TimerOP} &e%command sender% &rresumed the timer." to loop-player
  168.  
  169.  
  170. command /timer-array-reset:
  171. description: Reset the broadcast array of the timer
  172. usage: /timer-array-reset
  173. permission: skript.timer.array.reset
  174. trigger:
  175. delete {Timer.Array::*}
  176. add 1 to {Timer.Array::*}
  177. add 2 to {Timer.Array::*}
  178. add 3 to {Timer.Array::*}
  179. add 4 to {Timer.Array::*}
  180. add 5 to {Timer.Array::*}
  181. add 10 to {Timer.Array::*}
  182. add 15 to {Timer.Array::*}
  183. add 20 to {Timer.Array::*}
  184. add 30 to {Timer.Array::*}
  185. add 45 to {Timer.Array::*}
  186. add 60 to {Timer.Array::*}
  187. add 75 to {Timer.Array::*}
  188. add 90 to {Timer.Array::*}
  189. add 120 to {Timer.Array::*}
  190. add 150 to {Timer.Array::*}
  191. add 180 to {Timer.Array::*}
  192.  
  193. message "{@TimerOP} Successfully reset the broadcast array!"
  194.  
  195. command /timer-array-add <integer>:
  196. description: Add a mark to the broadcast array
  197. usage: /timer-array-add <mark>
  198. permission: skript.timer.array.add
  199. trigger:
  200. loop {Timer.Array::*}:
  201. loop-value is equal to arg 1
  202. message "{@TimerOP} This mark is already in the broadcast array!"
  203. stop trigger
  204.  
  205. add arg 1 to {Timer.Array::*}
  206. message "{@TimerOP} Added mark &9%arg 1% &rto the broadcast array!"
  207.  
  208. command /timer-array-remove <integer>:
  209. description: Remove a mark from the broadcast array
  210. usage: /timer-array-remove <mark>
  211. permission: skript.timer.array.remove
  212. trigger:
  213. loop {Timer.Array::*}:
  214. loop-value is equal to arg 1
  215. remove arg 1 from {Timer.Array::*}
  216. message "{@TimerOP} Removed mark &e%arg 1% &rfrom the broadcast array!"
  217. stop trigger
  218.  
  219. message "{@TimerOP} Mark &e%arg 1% &ris not in the broadcast array!"
  220.  
  221. command /timer-array-show:
  222. description: Shows the broadcast array
  223. usage: /timer-array-show
  224. permission: skript.timer.array.show
  225. trigger:
  226. message "{@TimerOP} The current broadcast array is:"
  227. message "&r%{Timer.Array::*}%"
  228.  
  229. command /timeleft:
  230. description: Shows how many minutes are left
  231. aliases: /timefleft
  232. usage: /timeleft
  233. trigger:
  234. if {Timer.Running} is not set:
  235. message "{@TimerBC} The timer is not running!"
  236. stop trigger
  237.  
  238. message "{@TimerBC} &e%{Timer.MeetupAt}-{Timer.MinutesPassed}% &rminutes remain until Meetup!"
  239. if {Timer.PvPCheck} is true:
  240. message "{@TimerBC} &e%{Timer.PvPAt}-{Timer.MinutesPassed}% &rminutes remain until PvP!"
  241.  
  242. command /timer-tmole:
  243. description: Toggle Mole status for the timer
  244. usage: /timer-tmole
  245. permission: skript.timer.tmole
  246. trigger:
  247. if {Timer.Mole} is not set:
  248. set {Timer.Mole} to true
  249. message "{@TimerOP} The Timer is now running in Mole Mode" to command sender
  250. stop trigger
  251.  
  252. if {Timer.Mole} is true:
  253. delete {Timer.Mole}
  254. message "{@TimerOP} The Timer is no longer running in Mole Mode" to command sender
  255. stop trigger
  256.  
  257.  
  258. command /timeboard [<text>]:
  259. permission: skript.op
  260. trigger:
  261. if arg-1 is "on" or "enable":
  262. message "{@TimerBC} Timeboard enabled!"
  263. set {Timeboard.enabled} to true
  264. if arg-1 is "off" or "disable":
  265. message "{@TimerBC} Timeboard disabled!"
  266. delete {Timeboard.enabled}
  267. if arg-1 is not set:
  268. if {Timeboard.enabled} is set:
  269. message "{@TimerBC} Timeboard is enabled!"
  270. else:
  271. message "{@TimerBC} Timeboard is disabled!"
  272.  
  273.  
  274.  
  275. every {@CheckFrequency} ticks:
  276. {Timer.Running} is true
  277. {Timer.Paused} is not set
  278.  
  279. if {Timer.MinutesPassed} is not equal to 0:
  280. set {_TimeSpan} to ("%{Timer.MinutesPassed}+1% minutes" parsed as timespan)
  281. if {Timer.MinutesPassed} is equal to 0:
  282. set {_TimeSpan} to ("%{Timer.MinutesPassed}+1% minute" parsed as timespan)
  283.  
  284. difference between {Timer.StartTime} and now is more than {_TimeSpan}:
  285.  
  286. set {Timer.MinutesPassed} to {Timer.MinutesPassed}+1
  287.  
  288. if {Timer.MinutesPassed} is equal to {Timer.MeetupAt}:
  289. delete {Timer.Running}
  290. delete {Timer.StartTime}
  291. delete {Timer.MinutesPassed}
  292. delete {Timer.MeetupAt}
  293. delete {Timer.PvPCheck}
  294. delete {Timer.PvPAt}
  295. delete {Timer.PauseTime}
  296. delete {Timer.TimeTilPvP}
  297. if {@UseInternalCommands} is true:
  298. execute console command "/timer-meetup"
  299. if {@UseInternalCommands} is false:
  300. execute console command "/meetup"
  301. stop trigger
  302.  
  303. set {_RemainingMinutes} to {Timer.MeetupAt}-{Timer.MinutesPassed}
  304. if {_RemainingMinutes} is greater than 0:
  305. {Timeboard.enabled} is set:
  306. execute console command "/scoreboard players set &c&oMeetup &7>&9UHC&7< %{_RemainingMinutes}%"
  307.  
  308.  
  309. if {_Timer.MinutesPast} is greater than or equal to {Timer.PvPat}:
  310. {Timeboard.enabled} is set:
  311. execute console command "/scoreboard players remove &b&oPvP &7>&9UHC&7< 1"
  312.  
  313.  
  314.  
  315.  
  316. loop {Timer.Array::*}:
  317. if loop-value is equal to {_RemainingMinutes}:
  318. if {_RemainingMinutes} is not equal to 1:
  319. broadcast "{@TimerBC} Meetup is in &e%{_RemainingMinutes}%&r minutes!"
  320. execute console command "/cMotd Game in progress! (Around &e%{_RemainingMinutes}%m&f left!)"
  321. if {_RemainingMinutes} is equal to 1:
  322. broadcast "{@TimerBC} Meetup is in &e%{_RemainingMinutes}% &rminute!"
  323. broadcast "{@TimerBC} &rPack your stuff! &rPrepare your journey to &e0,0!"
  324. exit 2 sections
  325.  
  326. if {Timer.PvPCheck} is true:
  327. set {Timer.TimeTilPvP} to ({Timer.PvPAt}-{Timer.MinutesPassed})
  328. {Timeboard.enabled} is set:
  329. execute console command "/scoreboard players set &b&oPvP &7>&9UHC&7< %{Timer.TimeTilPvP}%"
  330. if {Timer.MinutesPassed} is equal to {Timer.PvPAt}:
  331. delete {Timer.PvPCheck}
  332. delete {Timer.PvPAt}
  333. delete {Timer.TimeTilPvP}
  334. execute console command "/scoreboard players reset &b&oPvP"
  335. if {@UseInternalCommands} is true:
  336. execute console command "/timer-enablepvp"
  337. if {@UseInternalCommands} is false:
  338. execute console command "/enablepvp"
  339. if {Timer.Mole} is true:
  340. execute console command "/moles set"
  341. stop trigger
  342.  
  343.  
  344. if {Timer.Mole} is true:
  345. loop 5 times:
  346. if {Timer.MinutesPassed} is equal to ({Timer.PvPAt}-(loop-number)):
  347. if loop-number is not equal to 1:
  348. broadcast "{@TimerBC} &cPvP&r/&cMoles &rin &c%loop-number% &rminutes!"
  349. if loop-number is equal to 1:
  350. broadcast "{@TimerBC} &cPvP&r/&cMoles &rin &c%loop-number% &rminute!"
  351.  
  352.  
  353. if {@UseInternalCommands} is true:
  354. execute console command "/timer-aps note.bass"
  355. if {@UseInternalCommands} is false:
  356. execute console command "/aps note.bass"
  357.  
  358. if {Timer.Mole} is not set:
  359. loop 5 times:
  360. if {Timer.MinutesPassed} is equal to ({Timer.PvPAt}-(loop-number)):
  361. if loop-number is not equal to 1:
  362. broadcast "{@TimerBC} PvP is on in &e%loop-number% &rminutes!"
  363. if loop-number is equal to 1:
  364. broadcast "{@TimerBC} PvP is on in &e&l%loop-number% &r&lminute!"
  365. if loop-number is equal to 3:
  366. broadcast "{@TimerBC} Stalking before PvP is allowed!"
  367.  
  368. if {@UseInternalCommands} is true:
  369. execute console command "/sall note.bass 2"
  370. if {@UseInternalCommands} is false:
  371. execute console command "/sall note.bass 2"
  372.  
  373.  
  374. command /timer-meetup:
  375. description: Internal Timer command for Meetup
  376. usage: /timer-meetup
  377. permission: skript.timer.meetup
  378. trigger:
  379. broadcast "{@TimerBC} &eMEETUP TIME&r!&r Immediately head towards &l0,0!"
  380. broadcast "{@TimerBC} Stop farming apples! &rLeave your caves!"
  381. broadcast "{@TimerBC} The &eonly&r excuse for staying in an area is a fight!"
  382. loop 4 times:
  383. execute console command "/sall fireworks.launch 1"
  384. wait 0.05 seconds
  385. loop 10 times:
  386. execute console command "/sall note.bass 1"
  387. wait 0.1 second
  388. execute console command "/sall fireworks.largeBlast 1"
  389.  
  390.  
  391. command /timer-enablepvp:
  392. description: Internal Timer command for enabling PvP
  393. usage: /timer-enablepvp
  394. permission: skript.timer.enablepvp
  395. trigger:
  396. broadcast "{@TimerBC} &rPvP is ON!"
  397. loop 4 times:
  398. execute console command "/sall fireworks.launch 1"
  399. wait 0.05 seconds
  400. loop 10 times:
  401. execute console command "/sall note.bass 1"
  402. wait 0.1 second
  403. execute console command "/sall fireworks.largeBlast 1"
  404. execute console command "/pvptoggle world on"
  405.  
  406.  
  407.  
  408. command /timer-aps <text>:
  409. description: Internal Timer command to play a sound to everybody
  410. usage: /timer-aps <sound>
  411. permission: skript.timer.aps
  412. trigger:
  413. loop all players:
  414. execute console command "/playsound %arg 1% %loop-player%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement