SHARE
TWEET

Untitled

a guest Nov 19th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on quit:
  2.     if {queue::*} contains player:
  3.         queue(player)
  4.     if {ingame::*} contains player:
  5.         elim(player, "&7thought the map was too spooky.")
  6.  
  7. on join:
  8.     spawn(player)
  9.     while player is online:
  10.         if block under player is smooth sandstone:
  11.             elim(player)
  12.         wait 5 ticks
  13. function queue(p: offlineplayer):
  14.     if {queue::*} contains {_p}:
  15.         remove {_p} from {queue::*}
  16.         send formatted "&6&lMHWool &7You left the queue!" to {_p}
  17.  
  18.     else:
  19.         send formatted "&6&lMHWool &7You joined the queue!" to {_p}
  20.         add {_p} to {queue::*}
  21.  
  22. on load:
  23.     execute console command "/resetGame"
  24.  
  25. command /start [<text>]:
  26.     permission: op
  27.     permission message: &cno
  28.     trigger:
  29.         if {autoStart} is not set:
  30.             if {start} is not set:
  31.                 start()
  32.             else:
  33.                 send "&6&lMHWool &7The game already started."
  34.         else:
  35.             send "&6&lMHWool &7Auto starting is on!"
  36.  
  37.  
  38. function start():
  39.     if {notready} is set:
  40.         stop
  41.     set {start} to true
  42.     teleportCountdown()
  43.  
  44. function teleportCountdown():
  45.     loop 30 times:
  46.         if {start} is set:
  47.             if 30 - (loop-number - 1) = 30, 10, 5, 3, 2 or 1:
  48.                 send formatted "&6&lMHWool &7Teleporting in &e%30 - (loop-number - 1)% &7seconds." to all players
  49.             wait 1 second
  50.         else:
  51.             stop loop
  52.     startCountdown()
  53.  
  54. function randomTP(player: player) :: boolean:
  55.     if {queue::*} contains {_player}:
  56.         teleport {_player} to random location out of {spawns::*}
  57.         getReady({_player})
  58.  
  59. function startCountdown():
  60.     set {_randomSpawn::*} to all players where [randomTP(input) is true]
  61.     loop 10 times:
  62.         if {start} is set:
  63.             if 10 - (loop-number - 1) = 10, 5, 3, 2 or 1:
  64.                 send formatted "&6&lMHWool &7Starting in &e%10 - (loop-number - 1)% &7seconds." to all players
  65.             wait 1 second
  66.         else:
  67.             stop loop
  68.     if {start} is set:
  69.         delete {start}
  70.         set {started} to true
  71.         send formatted "&6&lMHWool &7The game has started!" to all players
  72.         set {ingame::*} to {queue::*}
  73.         set (all players where [{ingame::*} contains input])'s gamemode to survival
  74.         set {_gettingReady::*} to all players where [getReady(input) is true]
  75.         #resetLoot()
  76.         wait 10 seconds
  77.         loop 120 times:
  78.             if {started} is set:
  79.                 add 1 to {highestLayer}
  80.                 set y-coordinate of {reset::2} to 4+{highestLayer}
  81.                 fillLayer({game::1}, {game::2})
  82.                 set {game::1} to block above {game::1}
  83.                 set {game::2} to block above {game::2}
  84.                 wait 7 seconds
  85.                 clear {data::*}
  86.  
  87. #function resetLoot():
  88. #   set {_var::*} to {chestLoc::*} where [setLoot(input) = true]
  89.  
  90. on damage:
  91.     attacker is a player
  92.     victim is a player
  93.     if {ingame::*} does not contain attacker:
  94.         send "&cYou may not PvP at this time!" to attacker
  95.         cancel event
  96.     else if {ingame::*} does not contain victim:
  97.         send "&cYou may not PvP at this time!" to attacker
  98.         cancel event
  99.     else:
  100.         set maximum damage delay of attacker to 0 seconds
  101.  
  102. command /addspawn:
  103.     permission: *
  104.     trigger:
  105.         add player's location to {spawns::*}
  106.         send "&aA random spawnpoint was added at your location!"
  107.  
  108. #function setLoot(l: location) :: boolean:
  109. #   set block at {_l} to chest
  110. #   loop (random integer between 3 and 10 times):
  111. #       set slot (random integer between 0 and 26) of inventory of block at {_l} to random element out of {lootTable::*}
  112.  
  113. on right click on chest:
  114.     if {checked::*} contains event-location:
  115.         stop
  116.     if {start} is set:
  117.         send "&cPlease wait for the game to start before you get loot!"
  118.         cancel event
  119.         stop
  120.     if {started} is not set:
  121.         stop
  122.     player's gamemode is creative:
  123.         stop
  124.     clear inventory of event-block
  125.     loop (random integer between 3 and 6) times:
  126.         if {firstChest::*} does not contain player:
  127.             chance of 50%:
  128.                 set slot (random integer between 0 and 26) of event-block to 64 white wool
  129.             else:
  130.                 set slot (random integer between 0 and 26) of event-block to random item out of {lootTable::*}
  131.             add player to {firstChest::*}
  132.         else:
  133.             set slot (random integer between 0 and 26) of event-block to random item out of {lootTable::*}
  134.     add event-location to {checked::*}
  135.  
  136. # command /placechests:
  137. #   permission: *
  138. #   trigger:
  139. #       if {placing::%player%} is not set:
  140. #           set {placing::%player%} to true
  141. #           send "&aYou are now placing event chests!"
  142. #       else:
  143. #           clear {placing::%player%}
  144. #           send "&cPlacing disabled!"
  145.  
  146. # on place of chest:
  147. #   player has permission "*"
  148. #   if {placing::%player%} is set:
  149. #       add event-location to {chestLoc::*}
  150.  
  151. command /queue [<text>]:
  152.     aliases: /q
  153.     cooldown: 1 second
  154.     cooldown message: &cPlease wait %remaining time% &cbefore continuing!
  155.     trigger:
  156.         if arg-1 is not set:
  157.             send "&c/queue (join|leave|auto)"
  158.             stop
  159.         if arg-1 is "join" or "leave":
  160.             queue(player)
  161.         else:
  162.             if {autoqueue::*} does not contain player:
  163.                 send "&aEnabled auto queue!"
  164.                 add player to {autoqueue::*}
  165.                 add player to {queue::*} if {queue::*} does not contain player
  166.                 if {autoStart} is set:
  167.                     if size of {queue::*} >= 4:
  168.                         if {started} is not set:
  169.                             if {start} is not set:
  170.                                 if {notready} is not set:
  171.                                     broadcast "&aGame starting! Reached enough players!"
  172.                                     start()
  173.             else:
  174.                 send "&cDisabled auto queue!"
  175.                 remove player from {autoqueue::*}
  176.                 remove player from {queue::*}
  177.                 if {autoStart} is set:
  178.                     if size of {queue::*} < 4:
  179.                         if {started} is not set:
  180.                             if {start} is not set:
  181.                                 if {notready} is not set:
  182.                                     broadcast "&cAutomatic stop cancelled! Not enough players!"
  183.  
  184. # command /queue [<text>]:
  185. #   aliases: q
  186. #   cooldown: 2 seconds
  187. #   cooldown message: &cThis command is on cooldown! %remaining time%
  188. #   trigger:
  189. #       if arg-1 is not "join", "auto" or "leave":
  190. #           send "&8&m----------"
  191. #           send "&a/queue join"
  192. #           send "&a/queue auto"
  193. #           send "&a/queue leave"
  194. #           send "&8&m----------"
  195. #           cancel cooldown
  196. #       else:
  197. #           if arg-1 is "join" or "leave":
  198. #               if arg-1 is "join":
  199. #                   if {queue::*} doesn't contain player:
  200. #                       queue(player)
  201. #                   else:
  202. #                       send "&cYou're already in the queue!"
  203. #                       cancel cooldown
  204. #               else:
  205. #                   if {queue::*} contains player:
  206. #                       queue(player)
  207. #                   else:
  208. #                       send "&cYou're not in the queue!"
  209. #                       cancel cooldown
  210. #           else:
  211. #               if {autoqueue::%player%} is not set:
  212. #                   set {autoqueue::%player%} to true
  213. #                   send "&aEnabled Auto Queue!"
  214. #               else:
  215. #                   delete {autoqueue::%player%}
  216. #                   send "&cDisabled Auto Queue!"
  217. #               cancel cooldown
  218.  
  219. function endGame(winner: offlineplayer):
  220.     send formatted "", "&6&lMHWool &e%{_winner}% &7has won the match!" and "" to all players
  221.     set {wins::%{_winner}%} to ({wins::%{_winner}%} ? 0) + 1
  222.     wait 2 seconds
  223.     set {_all::*} to all players where [spawnAll(input) is true]
  224.     console command "/resetGame"
  225.  
  226. function spawnAll(player: player) :: boolean:
  227.     spawn({_player})
  228.  
  229. function elim(p: offlineplayer, t: text="&7was eliminated!"):
  230.     if {ingame::*} contains {_p}:
  231.         remove {_p} from {ingame::*}
  232.         set {_p}'s gamemode to spectator
  233.         send title "&c&lYou Died!" with subtitle "&7Better luck next time!" to {_p}
  234.         send formatted "&6&lMHWool &e%{_p}% &7%{_t}%" to all players
  235.         if size of {ingame::*} is 1:
  236.             set {_winner} to first element out of {ingame::*}
  237.             endGame({_winner})
  238.             # set {_all::*} to all players where [spawnAll(input) is true]
  239.         wait 2 seconds
  240.         send title "" with subtitle "" to {_p}
  241.  
  242. on death of player:
  243.     set {_pos} to victim's location
  244.     force victim to respawn
  245.     if {ingame::*} contains victim:
  246.         if attacker is not a player:
  247.             elim("%victim%" parsed as offlineplayer)
  248.         else:
  249.             elim("%victim%" parsed as offlineplayer, "&7was eliminated by &e%attacker%")
  250.     wait a tick
  251.     teleport victim to {_pos}
  252.  
  253. function spawn(player: player):
  254.     teleport {_player} to {spawn}
  255.     set {_player}'s gamemode to adventure
  256.     clear {_player}'s inventory
  257.     getReady({_player})
  258.  
  259. function getReady(player: player) :: boolean:
  260.     set {_player}'s health to {_player}'s max health
  261.     set {_player}'s food to 20
  262.  
  263. command /spawn:
  264.     trigger:
  265.         if {ingame::*} contains player:
  266.             send "&cYou may not use this command now!"
  267.             stop
  268.         spawn(player)
  269.  
  270. command /setspawn:
  271.     permission: *
  272.     trigger:
  273.         set {spawn} to player's location
  274.         send "&aSpawn was set!"
  275.  
  276. function restore():
  277.     set blocks at {placed::*} to air
  278.     clear {placed::*}
  279.  
  280. on break:
  281.     player's gamemode is not creative
  282.     if {placed::*} does not contain event-location:
  283.         send "&cYou can only break player placed blocks!"
  284.         cancel event
  285.         stop
  286.     if y-coordinate of event-block < {highestLayer}:
  287.         send "&cYou can not break this low!"
  288.         cancel event
  289.         stop
  290.  
  291. on place:
  292.     player's gamemode is not creative
  293.     add event-location to {placed::*}
  294.     set {restore::%event-location%} to block at event-location
  295.  
  296. on command:
  297.     if command is "me" or "minecraft:me":
  298.         cancel event
  299.         send "&cBad boy"
  300.  
  301. command /resetGame [<text>]:
  302.     permission: op
  303.     permission message: &cno
  304.     trigger:
  305.         delete {started}
  306.         delete {start}
  307.         delete {ingame::*}
  308.         clear {checked::*}
  309.         clear {highestLayer}
  310.         remove (all players where [{autoqueue::*} does not contain input]) from {queue::*}
  311.         delete all entities where [input is not a player]
  312.         execute console command "minecraft:kill @e[type=minecraft:ender_pearl]" # fixes a annoying bug
  313.         clear {firstChest::*}
  314.         set {game::1} to {test::1}
  315.         set {game::2} to {test::2}
  316.         set {_b::*} to all blocks within {reset::1} and {reset::2}
  317.         set {notready} to true
  318.         broadcast "&cMap resetting. Please wait!"
  319.         wait a tick
  320.         loop {_b::*}:
  321.             if block at loop-value is smooth sandstone:
  322.                 set block at loop-value to air
  323.         restore()
  324.         #   wait a tick
  325.         clear {notready}
  326.         broadcast "&aMap reset! Ready to continue!"
  327.  
  328. command /addloc [<text>]:
  329.     permission: op
  330.     permission message: &cno
  331.     trigger:
  332.         add location of block at player to {chestLoc::*}
  333.         send formatted "&6&lMHWool &7Added a chest location to &e%location of block at player%&7!"
  334.  
  335. command /addloot [<text>]:
  336.     permission: op
  337.     permission message: &cno
  338.     trigger:
  339.         if player's tool is not air:
  340.             add player's tool to {lootTable::*}
  341.             send formatted "&6&lMHWool &7Added &e%player's tool% &7to the loot table."
  342.         else:
  343.             send formatted "&6&lMHWool &7Please hold an item."
  344.  
  345.  
  346. function fillLayer(start: block, end: block):
  347.     getLayers({_start},{_end})
  348.     clear {data::*}
  349.  
  350. function getLayers(start: block, end: block):
  351.     loop 5 times:
  352.         loop 14 times:
  353.             wait 2 ticks # 1/4th a second
  354.             fillRow(({data::start} ? {_start}), ({data::end} ? {_end}))
  355.  
  356. function fillRow(start: block, end: block):
  357.     set {_b::*} to all blocks within {_start} and {_end}
  358.     loop {_b::*}:
  359.         if {started} is set:
  360.             if block at loop-value is air or cobweb: # Moved the check here since the where [] expression didnt seem to work
  361.                 set block at loop-value to smooth sandstone
  362.     set {data::start} to block 1 east of {_start}
  363.     set {data::end} to block 1 east of {_end}
  364.  
  365.  
  366. on rightclick:
  367.     if line 2 of clicked block contains "Queue":
  368.         make player execute command "queue join"
  369. on chat:
  370.     if player has permission "op":
  371.         set chat format to "&6%player%: &f%colored message%"
  372.     else:
  373.         if {chat} is set:
  374.             cancel event
  375.             send "&cChat is for staff only right now."
  376.         else:
  377.             set chat format to "&7%player%: &f%message%"
  378. on join:
  379.     set join message to "&a[+] &7%player%"
  380. on quit:
  381.     set quit message to "&c[-] &7%player%"
  382. on command "list":
  383.     cancel event
  384.     clear {staff::*}
  385.     loop all players:
  386.         if loop-player has permission "op":
  387.             add loop-player to {staff::*}
  388.     send ""
  389.     send "&bEvent Hosts Online: &e%{staff::*}%"
  390.     send ""
  391. command /chat:
  392.     permission: op
  393.     permission message: &cxd
  394.     trigger:
  395.         if {chat} is not set:
  396.             set {chat} to 1
  397.             broadcast ""
  398.             broadcast "&cChat disabled by %player%"
  399.             broadcast ""
  400.         else:
  401.             delete {chat}
  402.             broadcast ""
  403.             broadcast "&aChat enabled by %player%"
  404.             broadcast ""
  405. command /broadcast [<text>]:
  406.     aliases: /bc
  407.     permission: op
  408.     permission message: &clol should've joined the community events team or be a mod
  409.     trigger:
  410.         if arg 1 is set:
  411.             broadcast ""
  412.             broadcast "&6&lMHWool &7- &f%arg-1%"
  413.             broadcast ""
  414.             loop all players:
  415.                 send loop-player title "&6EVENT" with subtitle "&f%arg-1%" for 6 seconds
  416.         else:
  417.             send "&9Message> &cErr...something went wrong? (Look familiar lol &3&lTRAINEE&c)"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top