Advertisement
fleft17

Untitled

Aug 3rd, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.50 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.  
  50. # Broadcast the timer has started
  51. broadcast "{@TimerBC} &e%{Timer.MeetupAt}% &rminutes&r remain until &cMeetup!"
  52.  
  53. # PvP Stuff
  54. if arg 2 is set:
  55. if {Timer.Mole} is not set:
  56. broadcast "{@TimerBC} &cPvP &rwill be enabled in &e%arg 2% &rminutes!"
  57. if {Timer.Mole} is true:
  58. broadcast "{@TimerBC} &cPvP&r/&cMoles &rin &c%arg 2% &rminutes!"
  59. set {Timer.PvPCheck} to true
  60. set {Timer.PvPAt} to arg 2
  61.  
  62. # Message OPs who started a timer
  63.  
  64.  
  65.  
  66.  
  67.  
  68. command /timer-stop:
  69. description: Stops the timer
  70. usage: /timer-stop
  71. permission: skript.timer.stop
  72. trigger:
  73. # Timer even running?
  74. if {Timer.Running} is not set:
  75. message "{@TimerOP} The timer is not running!"
  76. stop trigger
  77.  
  78. # Delete variables
  79. delete {Timer.Running}
  80. delete {Timer.StartTime}
  81. delete {Timer.MinutesPassed}
  82. delete {Timer.MeetupAt}
  83. delete {Timer.PvPCheck}
  84. delete {Timer.PvPAt}
  85. delete {Timer.PauseTime}
  86.  
  87. # Broadcast the stopping of the timer
  88. broadcast "{@TimerBC} The timer has stopped."
  89.  
  90. # Message OPs who stopped the timer.
  91. if command sender is not the console:
  92. loop all players:
  93. loop-player has the permission "skript.timer.stop.notify"
  94. loop-player is not the command sender
  95. message "{@TimerOP} &e%command sender% &rstopped the timer&7." to loop-player
  96.  
  97.  
  98. command /timer-pause:
  99. description: Pause the timer
  100. usage: /timer-pause
  101. permission: skript.timer.pause
  102. trigger:
  103. set {_LocalTime} to now
  104.  
  105. # Timer even running?
  106. if {Timer.Running} is not set:
  107. message "{@TimerOP} The Timer is not running!"
  108. stop trigger
  109.  
  110. # Timer already paused?
  111. if {Timer.Paused} is true:
  112. message "{@TimerOP} The Timer is already paused!"
  113. stop trigger
  114.  
  115. set {Timer.Paused} to true
  116. set {Timer.PauseTime} to {_LocalTime}
  117.  
  118. # Broadcast the pausing of the timer
  119. broadcast "{@TimerBC} The Timer has been paused!"
  120.  
  121. # Message OPs who paused the timer
  122. if command sender is not the console:
  123. loop all players:
  124. loop-player has the permission "skript.timer.pause.notify"
  125. loop-player is not the command sender
  126. message "{@TimerOP} &e%command sender% &rpaused the timer." to loop-player
  127.  
  128.  
  129. command /timer-resume:
  130. description: Resume the timer
  131. usage: /timer-resume
  132. permission: skript.timer.resume
  133. trigger:
  134. set {_LocalTime} to now
  135.  
  136. if {Timer.Paused} is not set:
  137. message "{@TimerOP} The Timer is not paused!"
  138. stop trigger
  139.  
  140. # Fixing the start time by adding the time the timer was paused
  141. set {_Difference} to difference between {Timer.PauseTime} and {_LocalTime}
  142. set {Timer.StartTime} to {Timer.StartTime}+{_Difference}
  143.  
  144. # Deleting the unnecessary variables
  145. delete {Timer.Paused}
  146. delete {Timer.PauseTime}
  147.  
  148. # Broadcast the resuming of the timer
  149. broadcast "{@TimerBC} The Timer has been resumed!"
  150.  
  151. # Message OPs who resumed the timer
  152. if command sender is not the console:
  153. loop all players:
  154. loop-player has the permission "skript.timer.resume.notify"
  155. loop-player is not the command sender
  156. message "{@TimerOP} &e%command sender% &rresumed the timer." to loop-player
  157.  
  158.  
  159. command /timer-array-reset:
  160. description: Reset the broadcast array of the timer
  161. usage: /timer-array-reset
  162. permission: skript.timer.array.reset
  163. trigger:
  164. delete {Timer.Array::*}
  165. add 1 to {Timer.Array::*}
  166. add 2 to {Timer.Array::*}
  167. add 3 to {Timer.Array::*}
  168. add 4 to {Timer.Array::*}
  169. add 5 to {Timer.Array::*}
  170. add 10 to {Timer.Array::*}
  171. add 15 to {Timer.Array::*}
  172. add 20 to {Timer.Array::*}
  173. add 30 to {Timer.Array::*}
  174. add 45 to {Timer.Array::*}
  175. add 60 to {Timer.Array::*}
  176. add 75 to {Timer.Array::*}
  177. add 90 to {Timer.Array::*}
  178. add 120 to {Timer.Array::*}
  179. add 150 to {Timer.Array::*}
  180. add 180 to {Timer.Array::*}
  181.  
  182. message "{@TimerOP} Successfully reset the broadcast array!"
  183.  
  184. command /timer-array-add <integer>:
  185. description: Add a mark to the broadcast array
  186. usage: /timer-array-add <mark>
  187. permission: skript.timer.array.add
  188. trigger:
  189. loop {Timer.Array::*}:
  190. loop-value is equal to arg 1
  191. message "{@TimerOP} This mark is already in the broadcast array!"
  192. stop trigger
  193.  
  194. add arg 1 to {Timer.Array::*}
  195. message "{@TimerOP} Added mark &9%arg 1% &rto the broadcast array!"
  196.  
  197. command /timer-array-remove <integer>:
  198. description: Remove a mark from the broadcast array
  199. usage: /timer-array-remove <mark>
  200. permission: skript.timer.array.remove
  201. trigger:
  202. loop {Timer.Array::*}:
  203. loop-value is equal to arg 1
  204. remove arg 1 from {Timer.Array::*}
  205. message "{@TimerOP} Removed mark &e%arg 1% &rfrom the broadcast array!"
  206. stop trigger
  207.  
  208. message "{@TimerOP} Mark &e%arg 1% &ris not in the broadcast array!"
  209.  
  210. command /timer-array-show:
  211. description: Shows the broadcast array
  212. usage: /timer-array-show
  213. permission: skript.timer.array.show
  214. trigger:
  215. message "{@TimerOP} The current broadcast array is:"
  216. message "&r%{Timer.Array::*}%"
  217.  
  218. command /timeleft:
  219. description: Shows how many minutes are left
  220. aliases: /timefleft
  221. usage: /timeleft
  222. trigger:
  223. if {Timer.Running} is not set:
  224. message "{@TimerBC} The timer is not running!"
  225. stop trigger
  226.  
  227. message "{@TimerBC} &e%{Timer.MeetupAt}-{Timer.MinutesPassed}% &rminutes remain until Meetup!"
  228. if {Timer.PvPCheck} is true:
  229. message "{@TimerBC} &e%{Timer.PvPAt}-{Timer.MinutesPassed}% &rminutes remain until PvP!"
  230.  
  231. command /timer-tmole:
  232. description: Toggle Mole status for the timer
  233. usage: /timer-tmole
  234. permission: skript.timer.tmole
  235. trigger:
  236. if {Timer.Mole} is not set:
  237. set {Timer.Mole} to true
  238. message "{@TimerOP} The Timer is now running in Mole Mode" to command sender
  239. stop trigger
  240.  
  241. if {Timer.Mole} is true:
  242. delete {Timer.Mole}
  243. message "{@TimerOP} The Timer is no longer running in Mole Mode" to command sender
  244. stop trigger
  245.  
  246. every {@CheckFrequency} ticks:
  247. {Timer.Running} is true
  248. {Timer.Paused} is not set
  249.  
  250. if {Timer.MinutesPassed} is not equal to 0:
  251. set {_TimeSpan} to ("%{Timer.MinutesPassed}+1% minutes" parsed as timespan)
  252. if {Timer.MinutesPassed} is equal to 0:
  253. set {_TimeSpan} to ("%{Timer.MinutesPassed}+1% minute" parsed as timespan)
  254.  
  255. difference between {Timer.StartTime} and now is more than {_TimeSpan}:
  256.  
  257. set {Timer.MinutesPassed} to {Timer.MinutesPassed}+1
  258.  
  259. if {Timer.MinutesPassed} is equal to {Timer.MeetupAt}:
  260. delete {Timer.Running}
  261. delete {Timer.StartTime}
  262. delete {Timer.MinutesPassed}
  263. delete {Timer.MeetupAt}
  264. delete {Timer.PvPCheck}
  265. delete {Timer.PvPAt}
  266. delete {Timer.PauseTime}
  267. if {@UseInternalCommands} is true:
  268. execute console command "/timer-meetup"
  269. if {@UseInternalCommands} is false:
  270. execute console command "/meetup"
  271. stop trigger
  272.  
  273. set {_RemainingMinutes} to {Timer.MeetupAt}-{Timer.MinutesPassed}
  274.  
  275.  
  276. loop {Timer.Array::*}:
  277. if loop-value is equal to {_RemainingMinutes}:
  278. if {_RemainingMinutes} is not equal to 1:
  279. broadcast "{@TimerBC} Meetup is in &e%{_RemainingMinutes}%&r minutes!"
  280. execute console command "/cMotd Game in progress! (Around &e%{_RemainingMinutes}%m&f left!)"
  281. if {_RemainingMinutes} is equal to 1:
  282. broadcast "{@TimerBC} Meetup is in &e%{_RemainingMinutes}% &rminute!"
  283. broadcast "{@TimerBC} &rPack your stuff! &rPrepare your journey to &e0,0!"
  284. exit 2 sections
  285.  
  286. if {Timer.PvPCheck} is true:
  287. if {Timer.MinutesPassed} is equal to {Timer.PvPAt}:
  288. delete {Timer.PvPCheck}
  289. delete {Timer.PvPAt}
  290. if {@UseInternalCommands} is true:
  291. execute console command "/timer-enablepvp"
  292. if {@UseInternalCommands} is false:
  293. execute console command "/enablepvp"
  294. if {Timer.Mole} is true:
  295. execute console command "/moles set"
  296. stop trigger
  297.  
  298.  
  299. if {Timer.Mole} is true:
  300. loop 5 times:
  301. if {Timer.MinutesPassed} is equal to ({Timer.PvPAt}-(loop-number)):
  302. if loop-number is not equal to 1:
  303. broadcast "{@TimerBC} &cPvP&r/&cMoles &rin &c%loop-number% &rminutes!"
  304. if loop-number is equal to 1:
  305. broadcast "{@TimerBC} &cPvP&r/&cMoles &rin &c%loop-number% &rminute!"
  306.  
  307.  
  308. if {@UseInternalCommands} is true:
  309. execute console command "/timer-aps note.bass"
  310. if {@UseInternalCommands} is false:
  311. execute console command "/aps note.bass"
  312.  
  313. if {Timer.Mole} is not set:
  314. loop 5 times:
  315. if {Timer.MinutesPassed} is equal to ({Timer.PvPAt}-(loop-number)):
  316. if loop-number is not equal to 1:
  317. broadcast "{@TimerBC} PvP is on in &e%loop-number% &rminutes!"
  318. if loop-number is equal to 1:
  319. broadcast "{@TimerBC} PvP is on in &e&l%loop-number% &r&lminute!"
  320. if loop-number is equal to 3:
  321. broadcast "{@TimerBC} Stalking before PvP is allowed!"
  322.  
  323. if {@UseInternalCommands} is true:
  324. execute console command "/sall note.bass 2"
  325. if {@UseInternalCommands} is false:
  326. execute console command "/sall note.bass 2"
  327.  
  328.  
  329. command /timer-meetup:
  330. description: Internal Timer command for Meetup
  331. usage: /timer-meetup
  332. permission: skript.timer.meetup
  333. trigger:
  334. broadcast "{@TimerBC} &eMEETUP TIME&r!&r Immediately head towards &l0,0!"
  335. broadcast "{@TimerBC} Stop farming apples! &rLeave your caves!"
  336. broadcast "{@TimerBC} The &eonly&r excuse for staying in an area is a fight!"
  337. loop 4 times:
  338. execute console command "/sall fireworks.launch 1"
  339. wait 0.05 seconds
  340. loop 10 times:
  341. execute console command "/sall note.bass 1"
  342. wait 0.1 second
  343. execute console command "/sall fireworks.largeBlast 1"
  344.  
  345.  
  346. command /timer-enablepvp:
  347. description: Internal Timer command for enabling PvP
  348. usage: /timer-enablepvp
  349. permission: skript.timer.enablepvp
  350. trigger:
  351. broadcast "{@TimerBC} &rPvP is ON!"
  352. loop 4 times:
  353. execute console command "/sall fireworks.launch 1"
  354. wait 0.05 seconds
  355. loop 10 times:
  356. execute console command "/sall note.bass 1"
  357. wait 0.1 second
  358. execute console command "/sall fireworks.largeBlast 1"
  359. execute console command "/pvptoggle world on"
  360.  
  361.  
  362.  
  363. command /timer-aps <text>:
  364. description: Internal Timer command to play a sound to everybody
  365. usage: /timer-aps <sound>
  366. permission: skript.timer.aps
  367. trigger:
  368. loop all players:
  369. execute console command "/playsound %arg 1% %loop-player%"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement