CREAMPAN0408

Untitled

Feb 22nd, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 KB | None | 0 0
  1. #
  2. # PvPTimer (PvPTimer.sk)
  3. # By nfell2009
  4. # All rights reserved.
  5. #
  6.  
  7. options:
  8. P: &c&lPvPTimer &7»&e
  9. PE: &e
  10. DefaultTime: 1h
  11. AdminPerm: tp.admin
  12.  
  13. on script load:
  14. delete {tp::running}
  15. loop 10 times:
  16. if {tp::running} is not true:
  17. wait 1 second
  18. else:
  19. stop
  20. if {tp::running} is not true:
  21. broadcast "{@P} PvPTimer failed to start"
  22. broadcast "{@P} Error: Problem with timeparser.sk"
  23. broadcast "{@P} Details: {tp::running} is not true (value: %{tp::running}%)"
  24. set {tp::failed} to true
  25.  
  26. on join:
  27. if {tp::failed} is true:
  28. if player has permission "{@AdminPerm}":
  29. message "{@P} PvPTimer failed to start"
  30. message "{@P} Error: Problem with timeparser.sk"
  31. message "{@P} Details: {tp::running} is not true (value: %{tp::running}%)"
  32. if {tp::players::list::uuids::%uuid of player%} is not set:
  33. set {tp::players::list::uuids::%uuid of player%} to player
  34. set {tp::players::list::names::%player%} to uuid of player
  35. set {_d} to "tp::players::details::%uuid of player%::"
  36. execute console command "/timeparser QuickDate {@DefaultTime} %{_d}%time %{_d}%days %{_d}%hours %{_d}%minutes %{_d}%seconds"
  37. set {%{_d}%time} to {%{_d}%time} parsed as time span
  38. set {tp::players::details::%uuid of player%::protected} to true
  39. if {tp::players::list::uuids::%uuid of player%} is not player:
  40. set {tp::players::list::uuids::%uuid of player%} to player
  41.  
  42.  
  43. command /pvptimer [<text>] [<text>] [<text>]:
  44. trigger:
  45. if {tp::failed} is true:
  46. message "{@P} TimeParser failed to start. PvPTimer REQUIRES TimeParser to run."
  47. else if {tp::running} is not true:
  48. message "{@P} PvPTimer is waiting for TimeParser to start running."
  49. if arg 1 is not set:
  50. message "{@P} PvPTimer help:"
  51. message "{@P} /pvptimer check [player]"
  52. message "{@PE} - Checks yours or if provided, another players time"
  53. message "{@P} /pvptimer remove [player]"
  54. message "{@PE} - Removes yours or if provided, another players time"
  55. message "{@P} Providing another players name will require {@AdminPerm}"
  56. message "{@P} Admin commands:"
  57. if player has permission "{@AdminPerm}":
  58. message "{@P} /pvptimer set <player> <time>"
  59. message "{@PE} - Sets a players time. Uses format like: 1d1h1m1s"
  60. message "{@P} /pvptimer reload"
  61. message "{@PE} - Reloads PvPTimer"
  62. if arg 1 is "check":
  63. if arg 2 is not set:
  64. message "{@P} You have: %{tp::players::details::%uuid of player%::time}% time left!"
  65. else if player has permission "{@AdminPerm}":
  66. set {_u} to uuid of {tp::players::list::names::%arg 2%}
  67. message "{@P} %{_p}% has: %{tp::players::details::%{_u}%::time}% time left!"
  68. else:
  69. message "{@P} Missing permission: {@AdminPerm}"
  70. else if arg 1 is "remove":
  71. if arg 2 is not set:
  72. delete {tp::players::details::%uuid of player%::time}
  73. message "{@P} You're now out of PvP protection!"
  74. else if player has permission "{@AdminPerm}":
  75. set {_u} to {tp::players::list::names::%arg 2%}
  76. delete {tp::players::details::%{_u}%::time}
  77. set {tp::players::details::%{_u}%::protected} to false
  78. set {_p} to arg 2 parsed as player
  79. message "{@P} %{_p}% is now out of PvP protection"
  80. else:
  81. message "{@P} Missing permission: {@AdminPerm}"
  82. else if arg 1 is "set":
  83. if player has permission "{@AdminPerm}":
  84. if {tp::players::list::names::%arg 2%} is set:
  85. if arg 3 is set:
  86. set {_u} to {tp::players::list::names::%arg 2%}
  87. set {_d} to "tp::players::details::%{_u}%::"
  88. set {_p} to arg 2
  89. execute console command "/timeparser QuickDate %arg 3% %{_d}%time %{_d}%days %{_d}%hours %{_d}%minutes %{_d}%seconds"
  90. set {%{_d}%time} to {%{_d}%time} parsed as time span
  91. message "{@P} Set: %{_p}%'s time to: %{tp::players::details::%{_u}%::time}%"
  92. else:
  93. message "{@P} Missing arguments: time"
  94. else:
  95. message "{@P} That player doesn't appear to exist"
  96. else:
  97. message "{@P} Missing permission: {@AdminPerm}"
  98. else if arg 1 is "reload":
  99. if player has permission "{@AdminPerm}":
  100. if arg 2 is "all":
  101. message "{@P} Reloading: TimeParser"
  102. make player execute command "/sk reload timeparser"
  103. message "{@P} Reloaded: TimeParser"
  104. message "{@P} Reloading: PvPTimer"
  105. make player execute command "/sk reload pvptimer"
  106. message "{@P} Reloading: PvPTimer"
  107. else if arg 2 is not set:
  108. message "{@P} Reloading: PvPTimer"
  109. make player execute command "/sk reload pvptimer"
  110. message "{@P} Reloading: PvPTimer"
  111. else:
  112. message "{@P} Reload Help:"
  113. message "{@P} /pvptimer reload all"
  114. message "{@PE} - Reloads PvPTimer & TimeParser"
  115. message "{@P} /pvptimer reload"
  116. message "{@PE} - Reloads PvPTimer"
  117. else:
  118. message "{@P} Missing permission: {@AdminPerm}"
  119.  
  120. command /pvptimer-console [<text>] [<text>]:
  121. executable by: console
  122. trigger:
  123. if arg 1 is "remove":
  124. if arg 2 is set:
  125. set {_u} to {tp::players::list::names::%arg 2%}
  126. delete {tp::players::details::%{_u}%::time}
  127. set {tp::players::details::%{_u}%::protected} to false
  128. set {tp::players::details::%{_u}%::hasbeenmessaged} to true
  129. set {_p} to arg 2 parsed as player
  130. message "{@P} You no longer have PvP Protecion!" to {_p}
  131.  
  132.  
  133. on damage of player:
  134. if attacker is player:
  135. if {tp::players::details::%uuid of attacker%::protected} is true:
  136. cancel event
  137. message "{@P} You're currently under PvP protection! Do /pvptimer remove - to exit protection" to attacker
  138. else if {tp::players::details::%uuid of victim%::protected} is true:
  139. cancel event
  140. message "{@P} %victim% is currently under PvP protection!" to attacker
  141.  
  142. every 1 second:
  143. loop {tp::players::list::names::*}:
  144. set {_p} to {tp::players::list::uuids::%loop-value%}
  145. if {_p} is online:
  146. set {_u} to loop-value
  147. if {tp::players::details::%{_u}%::time} is less than or equal to 0 seconds:
  148. if {tp::players::details::%{_u}%::hasbeenmessaged} is not set:
  149. execute console command "/pvptimer-console remove %{_p}%"
  150. else:
  151. subtract 1 second from {tp::players::details::%{_u}%::time}
Add Comment
Please, Sign In to add comment