szumielxd

TimedRestart

Jan 13th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. command /timedrestart <integer>:
  2. permission: wlasciciel
  3. trigger:
  4. send "&2Wywolano funkcje restartu serwera za &c%arg% &2sekund"
  5. timedRestart(arg)
  6.  
  7.  
  8. function timedRestart(i: integer):
  9. if {_i} is not set:
  10. stop
  11.  
  12. if {_i} >= 120:
  13. set {_t} to mod({_i}, 60)
  14. if {_t} > 0:
  15. loop {_t} times:
  16. wait 1 second
  17. set {_i} to floor({_i}/60) * 60
  18. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b%{_i}/60% &3min."
  19. wait 1 minute
  20. remove 60 from {_i}
  21. set {_i} to "%{_i}%" parsed as integer
  22. timedRestart({_i})
  23. stop
  24.  
  25. else if {_i} >= 60:
  26. set {_t} to mod({_i}, 60)
  27. if {_t} > 0:
  28. loop {_t} times:
  29. wait 1 second
  30. set {_i} to floor({_i}/60) * 60
  31. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b60 &3sekund"
  32. wait 30 seconds
  33. remove 30 from {_i}
  34. timedRestart(30)
  35. stop
  36. else if {_i} >= 30:
  37. set {_t} to mod({_i}, 30)
  38. if {_t} > 0:
  39. loop {_t} times:
  40. wait 1 second
  41. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b30 &3sekund"
  42. wait 15 seconds
  43. timedRestart(15)
  44. stop
  45. else if {_i} >= 15:
  46. set {_t} to mod({_i}, 15)
  47. if {_t} > 0:
  48. loop {_t} times:
  49. wait 1 second
  50. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b15 &3sekund"
  51. wait 5 seconds
  52. timedRestart(10)
  53. stop
  54. else if {_i} >= 10:
  55. set {_t} to mod({_i}, 10)
  56. loop {_t} times:
  57. wait 1 second
  58. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b10 &3sekund"
  59. wait 5 seconds
  60. timedRestart(5)
  61. stop
  62. else if {_i} >= 5:
  63. set {_t} to mod({_i}, 5)
  64. if {_t} > 0:
  65. loop {_t} times:
  66. wait 1 second
  67. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b5 &3sekund"
  68. wait 1 second
  69. timedRestart(4)
  70. stop
  71. else if {_i} >= 4:
  72. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b4 &3sekundy"
  73. wait 1 second
  74. timedRestart(3)
  75. stop
  76. else if {_i} >= 3:
  77. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b3 &3sekundy"
  78. wait 1 second
  79. timedRestart(2)
  80. stop
  81. else if {_i} >= 2:
  82. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &b2 &3sekundy"
  83. wait 1 second
  84. timedRestart(1)
  85. stop
  86. else if {_i} >= 1:
  87. broadcast "&6[&eMcSurvi.pl&6] &3Serwer zostanie zrestartowany za &bsekunde"
  88. wait 1 second
  89. execute console command "restart"
  90. stop
Advertisement
Add Comment
Please, Sign In to add comment