Advertisement
CombatMC

Punish Script [Skript]

Jan 7th, 2019
668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. options:
  2. whitelisted-UUID: "2bbd185f-8124-4339-b5ae-db9a4c614fd5" or "e1e67f93-3047-42b8-ad96-d94c04777e30"
  3. message-permission: &cYou are not allowed to use this command!
  4. enable-log: true
  5. log-view-permission: "server.helper" or "server.mod" or "server.admin" or "server.owner"
  6. permission-tempban: server.helper
  7. permission-mute: server.helper
  8. permission-kick: server.helper
  9. permission-unban: server.admin
  10. permission-unmute: server.admin
  11. permission-history: server.helper
  12.  
  13. on connect:
  14. set {_Id} to {punishedId::%player%}
  15. if {punishedId::%player%} is set:
  16. if {punishedType::%{_Id}%} is "ban" or "kick":
  17. if {punishedType::%{_Id}%} is "kick":
  18. delete {punishedId::%player%}
  19. stop
  20. set {_bannedTime} to difference between now and {punishedTime::%{_Id}%}
  21. set {_ban-cooldown} to {punishedExpire::%{_Id}%}
  22. if {_bannedTime} is greater than {punishedExpire::%{_Id}%}:
  23. delete {punishedId::%player%}
  24. stop
  25. else:
  26. set {_timeleft} to {punishedExpire::%{_Id}%}
  27. reduce {_timeleft} by {_bannedTime}
  28. kick player due to "%nl%&f▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃%nl%&cYou have been banned:%nl%&f%{punishedReason::%{_Id}%}% &7[ID: %{punishedId::%player%}%] %nl%%nl%&cExpire Time: &f%{_timeleft}%%nl%&f▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃%nl%"
  29. if "{@enable-log}" is "true":
  30. sendStaff("&7[&c&lPUNISH LOG&7] &e%player% &chas been blocked from joining the server: &eBANNED%nl%&7[&c&lPUNISH LOG&7] &cExpire in: &e%{_timeleft}%")
  31. on chat:
  32. set {_Id} to {punishedId::%player%}
  33. if {punishedId::%player%} is set:
  34. if {punishedType::%{_Id}%} is "mute":
  35. set {_bannedTime} to difference between now and {punishedTime::%{_Id}%}
  36. set {_ban-cooldown} to {punishedExpire::%{_Id}%}
  37. if {_bannedTime} is greater than {punishedExpire::%{_Id}%}:
  38. delete {punishedId::%player%}
  39. stop
  40. else:
  41. set {_timeleft} to {punishedExpire::%{_Id}%}
  42. reduce {_timeleft} by {_bannedTime}
  43. send "&7[&c&lMUTE&7] &cYou are muted! Expire in &e%{_timeleft}%&c!" to player
  44. cancel event
  45. if "{@enable-log}" is "true":
  46. sendStaff("&7[&c&lPUNISH LOG&7] &e%player% &chas been blocked from send message: &eMUTED%nl%&7[&c&lPUNISH LOG&7] &cExpire in: &e%{_timeleft}%")
  47.  
  48. command //tempban [<player>] [<number>] [<text>] [<text>]:
  49. trigger:
  50. if executor don't have permission "{@permission-tempban}":
  51. send "{@message-permission}" to executor
  52. stop
  53. if arg 1 or arg 2 or arg 3 or arg 4 is not set:
  54. send "&cUsage: //tempban <player> <time span[ s / m / h / d ]> <reason>" to executor
  55. send "&cExample: //tempban %executor% 1 d Example" to executor
  56. stop
  57. if arg 2 <= 0:
  58. send "&cError: Time span can't be set to %arg 2% %arg 3%" to executor
  59. stop
  60. if arg 3 is not "s" or "m" or "h" or "d":
  61. send "&cError: Time span can't be set to %arg 2% %arg 3%" to executor
  62. stop
  63. if arg 4 is not set:
  64. send "&cUsage: //tempban <player> <time span[ s / m / h / d ]> <reason>" to executor
  65. send "&cExample: //tempban %executor% 1 d Example" to executor
  66. stop
  67. requestNewPunish(executor, arg 1, "ban", arg 2, arg 3, arg 4)
  68.  
  69. command //mute [<player>] [<number>] [<text>] [<text>]:
  70. trigger:
  71. if executor don't have permission "{@permission-mute}":
  72. send "{@message-permission}" to executor
  73. stop
  74. if arg 1 or arg 2 or arg 3 or arg 4 is not set:
  75. send "&cUsage: //mute <player> <time span[ s / m / h / d ]> <reason>" to executor
  76. send "&cExample: //mute %executor% 1 d Example" to executor
  77. stop
  78. if arg 2 <= 0:
  79. send "&cError: Time span can't be set to %arg 2% %arg 3%" to executor
  80. stop
  81. if arg 3 is not "s" or "m" or "h" or "d":
  82. send "&cError: Time span can't be set to %arg 2% %arg 3%" to executor
  83. stop
  84. if arg 4 is not set:
  85. send "&cUsage: //mute <player> <time span[ s / m / h / d ]> <reason>" to executor
  86. send "&cExample: //mute %executor% 1 d Example" to executor
  87. stop
  88. requestNewPunish(executor, arg 1, "mute", arg 2, arg 3, arg 4)
  89.  
  90. command //kick [<player>] [<text>]:
  91. trigger:
  92. if executor don't have permission "{@permission-kick}":
  93. send "{@message-permission}" to executor
  94. stop
  95. if arg 1 or arg 2 is not set:
  96. send "&cUsage: //kick <player> <reason>" to executor
  97. stop
  98. if arg 1 is not online:
  99. send "&cError: &e%arg 1% &cis not online!" to executor
  100. stop
  101. requestNewPunish(executor, arg 1, "kick", 0, "s", arg 2)
  102.  
  103. command //unban [<offline player>]:
  104. trigger:
  105. if executor don't have permission "{@permission-unban}":
  106. send "{@message-permission}" to executor
  107. stop
  108. if arg 1 is not set:
  109. send "&cUsage: //unban <player>" to executor
  110. stop
  111. if {punishedId::%arg 1%} is not set:
  112. send "&cError: &e%arg 1% &cis not banned!" to executor
  113. stop
  114. if {punishedType::%{punishedId::%arg 1%}%} is not "ban":
  115. send "&cError: &e%arg 1% &cis not banned!" to executor
  116. stop
  117. delete {punishedId::%arg 1%}
  118. send "&7[&c&lUNBAN&7] &e%arg 1% &chas been unbanned!" to all players
  119.  
  120. command //unmute [<offline player>]:
  121. trigger:
  122. if executor don't have permission "{@permission-unmute}":
  123. send "{@message-permission}" to executor
  124. stop
  125. if arg 1 is not set:
  126. send "&cUsage: //unmute <player>" to executor
  127. stop
  128. if {punishedId::%arg 1%} is not set:
  129. send "&cError: &e%arg 1% &cis not muted!" to executor
  130. stop
  131. if {punishedType::%{punishedId::%arg 1%}%} is not "mute":
  132. send "&cError: &e%arg 1% &cis not muted!" to executor
  133. stop
  134. delete {punishedId::%arg 1%}
  135. send "&7[&c&lUNMUTE&7] &e%arg 1% &chas been unmuted!" to all players
  136.  
  137. command //history [<offline player>]:
  138. trigger:
  139. if executor don't have permission "{@permission-history}":
  140. send "{@message-permission}" to executor
  141. stop
  142. send "&7[&c&lHISTORY&7] &e%arg 1%&c's history:" to executor
  143. loop {punishedPlayer::*}:
  144. if "%{punishedPlayer::%loop-index%}%" is equal to "%arg 1%":
  145. set {_punishType} to toUpperCase("%{punishedType::%loop-index%}%")
  146. if {punishedType::%loop-index%} is "ban" or "mute":
  147. set {_bannedTime} to difference between now and {punishedTime::%loop-index%}
  148. set {_ban-cooldown} to {punishedExpire::%loop-index%}
  149. if {_bannedTime} is greater than {punishedExpire::%loop-index%}:
  150. set {_punishStat} to "&c[Expired]"
  151. else if "%{punishedId::%arg 1%}%" is equal to "%loop-index%":
  152. set {_punishStat} to "&a[Active]"
  153. else:
  154. set {_punishStat} to "&c[Expired]"
  155. else:
  156. set {_punishStat} to ""
  157. send "&7[&c&lHISTORY&7] &c[%{_punishType}%] &7[##%loop-index%] &e[%{punishedTime::%loop-index%}%] &c» &e%{punishedReason::%loop-index%}% %{_punishStat}%" to executor
  158.  
  159. function requestNewPunish(executor: player, player: player, type: text, expireTimeArg1: number, expireTimeArg2: text, reason: text):
  160. if {_player}'s UUID is {@whitelisted-UUID}:
  161. send "&cYou are not allowed to %{_type}% this player!" to {_executor}
  162. if "{@enable-log}" is "true":
  163. sendStaff("&7[&c&lPUNISH LOG&7] &e%{_executor}% &chas been blocked from punish &e%{_player}%&c: &ePlayer Whitelisted%nl%&7[&c&lPUNISH LOG&7] &cCurrenct Time: &e%now%")
  164. stop
  165. if {_expireTimeArg2} is not "s" or "m" or "h" or "d":
  166. stop
  167. if {_expireTimeArg2} is "s":
  168. set {_arg2} to "second"
  169. else if {_expireTimeArg2} is "m":
  170. set {_arg2} to "minute"
  171. else if {_expireTimeArg2} is "h":
  172. set {_arg2} to "hour"
  173. else if {_expireTimeArg2} is "d":
  174. set {_arg2} to "day"
  175. if {_expireTimeArg1} > 1:
  176. set {_arg3} to "s"
  177. else:
  178. set {_arg3} to ""
  179. set {_timespan} to ("%{_expireTimeArg1}% %{_arg2}%%{_arg3}%" parsed as time span)
  180. getNewPunish({_executor}, {_player}, {_type}, {_timespan}, {_reason})
  181.  
  182. function getNewPunish(executor: player, player: player, type: text, expireTime: time span, reason: text):
  183. set {_toggleWhile} to true
  184. while {_toggleWhile}:
  185. set {_Id} to random integer between 100000 and 999999
  186. if {punishedPlayer::%{_Id}%} is not set:
  187. set {_toggleWhile} to false
  188. set {punishedId::%{_player}%} to {_Id}
  189. set {punishedPlayer::%{_Id}%} to {_player}
  190. set {punishedType::%{_Id}%} to {_type}
  191. set {punishedTime::%{_Id}%} to now
  192. set {punishedExpire::%{_Id}%} to {_expireTime}
  193. set {punishedReason::%{_Id}%} to {_reason}
  194. if {_type} is "kick" or "ban" or "mute":
  195. if {_type} is "kick":
  196. set {_action} to "kicked"
  197. else if {_type} is "ban":
  198. set {_action} to "banned"
  199. else if {_type} is "mute":
  200. set {_action} to "muted"
  201. set {_punishTitle} to toUpperCase({_type})
  202. if {_type} is "kick":
  203. kick {_player} due to "%nl%&f▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃%nl%&cYou have been %{_action}%:%nl%&f%{punishedReason::%{_Id}%}% &7[ID: %{punishedId::%{_player}%}%] %nl%%nl%&f▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃%nl%"
  204. send "&7[&c&l%{_punishTitle}%&7] &e%{punishedPlayer::%{_Id}%}% &chas been %{_action}% &cfor: &e%{punishedReason::%{_Id}%}%&c!" to all players
  205. else if {_type} is "ban":
  206. kick {_player} due to "%nl%&f▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃%nl%&cYou have been %{_action}%:%nl%&f%{punishedReason::%{_Id}%}% &7[ID: %{punishedId::%{_player}%}%] %nl%%nl%&cExpire Time: &f%{punishedExpire::%{_Id}%}%%nl%&f▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃▃%nl%"
  207. send "&7[&c&l%{_punishTitle}%&7] &e%{punishedPlayer::%{_Id}%}% &chas been %{_action}% &e%{punishedExpire::%{_Id}%}% &cfor: &e%{punishedReason::%{_Id}%}%&c!" to all players
  208. else if {_type} is "mute":
  209. send "&7[&c&l%{_punishTitle}%&7] &e%{punishedPlayer::%{_Id}%}% &chas been %{_action}% &e%{punishedExpire::%{_Id}%}% &cfor: &e%{punishedReason::%{_Id}%}%&c!" to all players
  210.  
  211. function sendStaff(message: text):
  212. loop all players:
  213. if loop-player has permission {@log-view-permission}:
  214. send "%{_message}%" to loop-player
  215.  
  216. function toUpperCase(text: text) :: text:
  217. replace "a" with "A" in {_text}
  218. replace "b" with "B" in {_text}
  219. replace "c" with "C" in {_text}
  220. replace "d" with "D" in {_text}
  221. replace "e" with "E" in {_text}
  222. replace "f" with "F" in {_text}
  223. replace "g" with "G" in {_text}
  224. replace "h" with "H" in {_text}
  225. replace "i" with "I" in {_text}
  226. replace "j" with "J" in {_text}
  227. replace "k" with "K" in {_text}
  228. replace "l" with "L" in {_text}
  229. replace "m" with "M" in {_text}
  230. replace "n" with "N" in {_text}
  231. replace "o" with "O" in {_text}
  232. replace "p" with "P" in {_text}
  233. replace "q" with "Q" in {_text}
  234. replace "r" with "R" in {_text}
  235. replace "s" with "S" in {_text}
  236. replace "t" with "T" in {_text}
  237. replace "u" with "U" in {_text}
  238. replace "v" with "V" in {_text}
  239. replace "w" with "W" in {_text}
  240. replace "x" with "X" in {_text}
  241. replace "y" with "Y" in {_text}
  242. replace "z" with "Z" in {_text}
  243. return {_text}
  244.  
  245. function toLowerCase(text: text) :: text:
  246. replace "A" with "a" in {_text}
  247. replace "B" with "b" in {_text}
  248. replace "C" with "c" in {_text}
  249. replace "D" with "d" in {_text}
  250. replace "E" with "e" in {_text}
  251. replace "F" with "f" in {_text}
  252. replace "G" with "g" in {_text}
  253. replace "H" with "h" in {_text}
  254. replace "I" with "i" in {_text}
  255. replace "J" with "j" in {_text}
  256. replace "K" with "k" in {_text}
  257. replace "L" with "l" in {_text}
  258. replace "M" with "m" in {_text}
  259. replace "N" with "n" in {_text}
  260. replace "O" with "o" in {_text}
  261. replace "P" with "p" in {_text}
  262. replace "Q" with "q" in {_text}
  263. replace "R" with "r" in {_text}
  264. replace "S" with "s" in {_text}
  265. replace "T" with "t" in {_text}
  266. replace "U" with "u" in {_text}
  267. replace "V" with "v" in {_text}
  268. replace "W" with "w" in {_text}
  269. replace "X" with "x" in {_text}
  270. replace "Y" with "y" in {_text}
  271. replace "Z" with "z" in {_text}
  272. return {_text}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement