ReportCards

Skript Challenge #1 | Spleef

May 18th, 2020
2,982
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # » Spleef «
  2. # Created By: ReportCards (@Riley#9202 On Discord)
  3. # » Spleef «
  4. # Usage:
  5. # /spleef setmap | Generate arena
  6. # /spleef setlobby | Set spawn location
  7. # /spleef join | Join queue
  8. # Game time: ~4 Minutes
  9. # Made in: ~3 Hours
  10.  
  11.  
  12. on script load:
  13.   if {spleef::game} is set:
  14.     broadcast "&4&l• &cThe script has reloaded, the game has been forcefully stopped"
  15.     clear {spleef::game::*}
  16.     clear {spleef::queue::*}
  17.     delete {spleef::game}
  18.     delete {spleef::game.decay}
  19.   if {spleef::queue::*} is set:
  20.     broadcast "&4&l• &cThe script has reloaded, the game has been forcefully stopped"
  21.     clear {spleef::queue::*}
  22.     delete {spleef::game}
  23.     delete {spleef::game.decay}
  24.  
  25. on quit:
  26.   if {spleef::queue::%player%} is set:
  27.     delete {spleef::queue::%player%}
  28.     broadcast "&bSpleef &3&l• &b%player% &fhas left whilst in the queue!"
  29.   if {spleef::game::*} contains player:
  30.     remove player from {spleef::game::*}
  31.     loop {spleef::game::*}:
  32.       send "&bSpleef &3&l• &b%player% &fhas been eliminated. &3(&b%size of {spleef::game::*}% &bPlayers Left&3)" to loop-value
  33.     send "&bSpleef &3&l• &fYou have been eliminated."
  34.     checkWinner()
  35.    
  36.  
  37. function buildMap(ploc: Location, world: World):
  38.   set {_loc1} to location at x coord of {_ploc} + 25, y coord of {_ploc} - 20, z coord of {_ploc} + 25 in world {_world}
  39.   set {_loc2} to location at x coord of {_ploc} - 25, y coord of {_ploc} + 5, z coord of {_ploc} - 25 in world {_world}
  40.   set all blocks within {_loc1} and {_loc2} to air
  41.   wait 1 tick
  42.   set {_loc1} to location at x coord of {_ploc} + 25, y coord of {_ploc} - 1, z coord of {_ploc} + 25 in world {_world}
  43.   set {_loc2} to location at x coord of {_ploc} - 25, y coord of {_ploc} - 1, z coord of {_ploc} - 25 in world {_world}
  44.   set all blocks within {_loc1} and {_loc2} to snow block
  45.   wait 1 tick
  46.   set {_loc1} to location at x coord of {_ploc} + 25, y coord of {_ploc} - 5, z coord of {_ploc} - 25 in world {_world}
  47.   set {_loc2} to location at x coord of {_ploc} - 25, y coord of {_ploc} + 5, z coord of {_ploc} - 25 in world {_world}
  48.   set all blocks within {_loc1} and {_loc2} to black concrete
  49.   wait 1 tick
  50.   set {_loc1} to location at x coord of {_ploc} - 25, y coord of {_ploc} - 5, z coord of {_ploc} + 25 in world {_world}
  51.   set {_loc2} to location at x coord of {_ploc} - 25, y coord of {_ploc} + 5, z coord of {_ploc} - 25 in world {_world}
  52.   set all blocks within {_loc1} and {_loc2} to black concrete
  53.   wait 1 tick
  54.   set {_loc1} to location at x coord of {_ploc} + 25, y coord of {_ploc} - 5, z coord of {_ploc} + 25 in world {_world}
  55.   set {_loc2} to location at x coord of {_ploc} + 25, y coord of {_ploc} + 5, z coord of {_ploc} - 25 in world {_world}
  56.   set all blocks within {_loc1} and {_loc2} to black concrete
  57.   wait 1 tick
  58.   set {_loc1} to location at x coord of {_ploc} - 25, y coord of {_ploc} - 5, z coord of {_ploc} + 25 in world {_world}
  59.   set {_loc2} to location at x coord of {_ploc} + 25, y coord of {_ploc} + 5, z coord of {_ploc} + 25 in world {_world}
  60.   set all blocks within {_loc1} and {_loc2} to black concrete
  61.   wait 1 tick
  62.   set {_loc1} to location at x coord of {_ploc} + 25, y coord of {_ploc} - 5, z coord of {_ploc} + 25 in world {_world}
  63.   set {_loc2} to location at x coord of {_ploc} - 25, y coord of {_ploc} - 15, z coord of {_ploc} - 25 in world {_world}
  64.   set all blocks within {_loc1} and {_loc2} to red concrete
  65.   wait 1 tick
  66.   set {_loc1} to location at x coord of {_ploc} + 24, y coord of {_ploc} + 5, z coord of {_ploc} + 24 in world {_world}
  67.   set {_loc2} to location at x coord of {_ploc} - 24, y coord of {_ploc} + 5, z coord of {_ploc} - 24 in world {_world}
  68.   set all blocks within {_loc1} and {_loc2} to light gray stained glass
  69.   set {_loc1} to location at x coord of {_ploc}, y coord of {_ploc} + 5, z coord of {_ploc} in world {_world}
  70.   set block at {_loc1} to gold block
  71.  
  72. function checkWinner():
  73.   if size of {spleef::game::*} is less than 2:
  74.     set {_winner} to first element out of {spleef::game::*}
  75.     broadcast "&bSpleef &3&l• &b%{_winner}% &fhas won &bSpleef&f!"
  76.     play sound "ui.toast.challenge_complete" with volume 1 and pitch 2 to all players
  77.     teleport all players to {spleef::lobby}
  78.     set {_lobby} to {spleef::lobby}
  79.     set {_map} to {spleef::map}
  80.     clear {spleef::*}
  81.     set {spleef::map} to {_map}
  82.     set {spleef::lobby} to {_lobby}
  83.     buildMap({_map}, world of {_map})
  84.     loop all players:
  85.       clear loop-player's inventory
  86.      set loop-player's gamemode to adventure
  87.    make console execute "/effect clear @a"
  88.  
  89. function startGame():
  90.   loop {spleef::queue::*}:
  91.     set {_random} to random number between -20 and 20
  92.     set {_loc1} to location at x coord of {spleef::map} + {_random}, y coord of {spleef::map} + 1, z coord of {spleef::map} + {_random} in world of {spleef::map}
  93.     teleport loop-value to {_loc1}
  94.     add loop-value to {spleef::game::*}
  95.     remove loop-value from {spleef::queue::*}
  96.   delete {spleef::queue}
  97.   clear {spleef::queue::*}
  98.   broadcast "&bSpleef &3&l• &fThe game is starting!"
  99.   loop {spleef::game::*}:
  100.     send "&bSpleef &3&l• &fDestroy snow blocks from underneath other players!" to loop-value
  101.     send "&bSpleef &3&l• &fYou will get your shovel in 5 seconds!" to loop-value
  102.     play sound "block.snow.fall" with volume 1 and pitch 0.75 to loop-value
  103.     clear loop-value's inventory
  104.    giveItems(loop-value)
  105.   set {spleef::game} to 0
  106. function giveItems(p: Player):
  107.   wait 5 seconds
  108.   add diamond shovel of efficiency 3 to inventory of {_p}
  109.   set {_p}'s gamemode to survival
  110.  apply potion of saturation 10 without particles to {_p} for 1 day
  111. on damage:
  112.   cancel event
  113.  
  114. every 20 seconds:
  115.   if {spleef::queue} is not set:
  116.     if size of {spleef::queue::*} is greater than 0:
  117.       if {spleef::game} is not set:
  118.         broadcast "&7"
  119.         broadcast "&3&l » &bThe queue currently has %size of {spleef::queue::*}% &bplayer(s)! &3(&b/spleef join&3)"
  120.         broadcast "&7"
  121.  
  122. every second:
  123.   if {spleef::game} is not set:
  124.     if size of {spleef::queue::*} >= 2:
  125.       if {spleef::queue} is not set:
  126.         broadcast "&bSpleef &3&l• &fThe game is starting in 20 seconds, join with &b/sp join"
  127.         set {spleef::queue} to 20
  128.       else:
  129.         remove 1 from {spleef::queue}
  130.         if {spleef::queue} is 0:
  131.           startGame()
  132.           stop
  133.         send action bar "&bSpleef &3&l• &7Starting in &b%{spleef::queue}% &bSeconds &3(&b/sp join&3)" to all players
  134.         if {spleef::queue} <= 5:
  135.           play sound "block.note_block.bit" with volume 0.5 and pitch 5 to all players
  136.     else:
  137.       if {spleef::queue} is set:
  138.         broadcast "&bSpleef &3&l• &fThe queue has been cancelled since there are not enough players."
  139.         delete {spleef::queue}
  140.         delete {spleef::queue::*}
  141.   else:
  142.     add 1 to {spleef::game}
  143.     checkWinner()
  144.     if {spleef::game} < 30:
  145.       set {_next} to "Speed I"
  146.     else if {spleef::game} is 30:
  147.       loop {spleef::game::*}:
  148.         apply potion of speed 1 without particles to loop-value for 1 day
  149.         send "&bSpleef &3&l• &fYou've received Speed I!" to loop-value
  150.     else if {spleef::game} is between 31 and 59:
  151.       set {_next} to "Speed II"
  152.     else if {spleef::game} is 60:
  153.       loop {spleef::game::*}:
  154.         apply potion of speed 2 without particles to loop-value for 1 day
  155.         send "&bSpleef &3&l• &fYou've received Speed II!" to loop-value
  156.     else if {spleef::game} is between 61 and 119:
  157.       set {_next} to "Map Decay"
  158.     else if {spleef::game} is 120:
  159.       set {spleef::game.decay} to true
  160.       loop {spleef::game::*}:
  161.         send "&bSpleef &3&l• &fThe map will now start slowly decaying!" to loop-value
  162.      
  163.     set {_time} to "%{spleef::game}% Seconds" parsed as timespan
  164.     loop {spleef::game::*}:
  165.       send action bar "&3Spleef &b&l• &7The game has been running for &3%{_time}%&7. &b(&3Next Event: &7%{_next} ? ""None""%&b)" to loop-value
  166.   if {spleef::game.decay} is set:
  167.     set {_world} to world of {spleef::map}
  168.     set {_loc1} to location at x coord of {spleef::map} + 25, y coord of {spleef::map} - 1, z coord of {spleef::map} + 25 in world {_world}
  169.     set {_loc2} to location at x coord of {spleef::map} - 25, y coord of {spleef::map} - 1, z coord of {spleef::map} - 25 in world {_world}
  170.     loop all blocks within {_loc1} and {_loc2}:
  171.       if loop-block is packed ice:
  172.         set loop-block to ice
  173.       else if loop-block is ice:
  174.         set loop-block to air
  175.       if loop-block is a snow block:
  176.         set {_random} to random integer between 1 and (600 - (({spleef::game} - 120) * 1.5))
  177.         if {_random} is 1:
  178.           set loop-block to packed ice
  179.    
  180.  
  181. command /spleef [<text = "help">] [<text>]:
  182.   aliases: /sp
  183.   trigger:
  184.     if arg-1 is "help":
  185.       send "&b/sp help &3&l• &fList all of the available commands"
  186.       send "&b/sp join &3&l• &fJoin the queue"
  187.       send "&b/sp leave &3&l• &fLeave the queue"
  188.       if player has permission "spleef.admin":
  189.         send "&c/sp setmap &3&l• &fSets the center of all maps to your location"
  190.         send "&c/sp setlobby &3&l• &fSets the lobby location (Server spawn location)"
  191.     else if arg-1 is "join":
  192.       if {spleef::queue::%player%} is not set:
  193.         if {spleef::map} is not set:
  194.           if {spleef::lobby} is not set:
  195.             send "&bSpleef &3&l• &fThe game is not set up correctly. Please ask an admin to finish the setup!"
  196.             stop
  197.           else:
  198.             send "&bSpleef &3&l• &fThe game is not set up correctly. Please ask an admin to finish the setup!"
  199.             stop
  200.         else if {spleef::lobby} is not set:
  201.           send "&bSpleef &3&l• &fThe game is not set up correctly. Please ask an admin to finish the setup!"
  202.           stop
  203.         set {spleef::queue::%player%} to player
  204.         send "&bSpleef &3&l• &fYou have joined the queue for &bSpleef"
  205.       else:
  206.         send "&4&l • &cYou are already queued!"
  207.     else if arg-1 is "leave":
  208.       if {spleef::queue::%player%} is set:
  209.         delete {spleef::queue::%player%}
  210.         send "&bSpleef &3&l• &fYou have left the queue."
  211.       else:
  212.         send "&bSpleef &3&l• &fYou're not in the queue, to join the queue please use &b/mhp join"
  213.     else if arg-1 is "setmap":
  214.       if player has permission "spleef.admin":
  215.         if {confirm.%player%} is not set:
  216.           send "&cSetting a new map location will clear the area around you, please use this with caution! Type the command again to set the map location."
  217.           set {confirm.%player%} to false
  218.           wait 10 seconds
  219.           if {confirm.%player%} is set:
  220.             delete {confirm.%player%}
  221.         else:
  222.           if y coord of location of player is greater than 245:
  223.             send "&4&l • &cYou are too high up to set the map here!"
  224.             stop
  225.           else if y coord of location of player is less than 10:
  226.             send "&4&l • &cYou are too low up to set the map here!"
  227.             stop
  228.           set {spleef::map} to location of player
  229.           send "&bSpleef &3&l• &fYou have set the main map location to %player's location%"
  230.           delete {confirm.%player%}
  231.           set {_ploc} to player's location
  232.          send "%{spleef::map}%"
  233.           buildMap({_ploc}, event-world)
  234.     else if arg-1 is "setlobby":
  235.       if player has permission "spleef.admin":
  236.         send "&bSpleef &3&l• &fYou have set the lobby location to %player's location%"
  237.         set {spleef::lobby} to location of player
  238.  
  239. on step on red concrete:
  240.   if {spleef::game::*} contains player:
  241.     remove player from {spleef::game::*}
  242.     loop {spleef::game::*}:
  243.       send "&bSpleef &3&l• &b%player% &fhas been eliminated. &3(&b%size of {spleef::game::*}% &bPlayers Left&3)" to loop-value
  244.     send "&bSpleef &3&l• &fYou have been eliminated."
  245.     make console execute "/effect clear %player%"
  246.     checkWinner()
  247.     teleport player to {spleef::lobby}
  248.     clear player's inventory
  249.  
  250. on break:
  251.   if player's gamemode is creative:
  252.    stop
  253.   if event-block is not snow block:
  254.     cancel event
  255.   else:
  256.     clear drops
  257.  
  258. command /lobby:
  259.   trigger:
  260.     teleport player to {spleef::lobby}
  261.  
  262. on join:
  263.   teleport player to {spleef::lobby}
  264.   make console execute "/effect clear %player%"
RAW Paste Data