Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on load:
- set {spawn} to location (479, 121, 473) in world "ul_void"
- set {spawn}'s yaw to 298.2
- set {spawn}'s pitch to -0.03
- resetGameCore(2, 6)
- initModes("elimination", 23)
- loop all players:
- resetPlayerData(loop-player)
- on join:
- resetPlayerData(player)
- send ""
- send "&7Welcome! Do &a/games &7to join a game!"
- send ""
- toSpawn(player)
- on quit:
- removeFromAllQueues(player)
- on damage:
- set {_matchnum} to {player::%victim%::ingame}
- if {_matchnum} < 0:
- cancel event
- else if {games::match%{_matchnum}%::state} < 3:
- cancel event
- else if {games::match%{_matchnum}%::state} >= 3:
- if {player::%attacker%::ingame} = {_matchnum}:
- set {_gamer} to whatTeamIsThePlayerOn(victim, {_matchnum})
- set {_gamer2} to whatTeamIsThePlayerOn(attacker, {_matchnum})
- if {_gamer} = {_gamer2}:
- cancel event
- function toSpawn(p: player):
- set {_loc} to the location (479, 121, 473) in world "ul_void"
- set {_loc}'s yaw to 270
- set {_loc}'s pitch to 0.001
- teleport {_p} to {_loc}
- function whatTeamIsThePlayerOn(p: player, match: number) :: text:
- if {games::match%{_match}%::team1::*} contains {_p}:
- return "team1"
- else if {games::match%{_match}%::team2::*} contains {_p}:
- return "team2"
- else:
- return "none"
- function generalReadyPlayer(p: player):
- wait 2 ticks
- heal {_p}
- clear the inventory of {_p}
- set {_p}'s gamemode to adventure
- function resetPlayerData(p: player):
- set {_uuid} to uuid of {_p}
- if {player::%{_p}%} is not set:
- set {player::%{_p}%} to {_uuid}
- if {uplayer::%{_uuid}%} is not set:
- set {uplayer::%{_uuid}%} to {_p}
- set {player::%{_p}%::ingame} to -1
- set {_p} tab name to "&7%{_p}%"
- resetTabList({_p})
- resetSidebar({_p})
- function resetTabList(p: player):
- set tab header to "\n&6&lTHREE\n" and footer to "&73v3" for {_p}
- function resetSidebar(p: player):
- wipe {_p}'s sidebar
- set name of sidebar of {_p} to "&6&lTHREE"
- set score "&a" in sidebar of {_p} to 30
- set score "&73v3? You bet" in sidebar of {_p} to 20
- set score "&b" in sidebar of {_p} to 10
- function resetGameCore(minnum: number, maxnum: number):
- delete {games::*}
- set {games::properties} to true
- set {games::properties::maxqueue} to {_maxnum}
- set {games::properties::minqueue} to {_minnum}
- set {games::properties::basex} to 450000
- set {games::properties::basey} to 4
- set {games::properties::basez} to 0
- set {games::maps} to true
- set {games::maps::tdm2} to true
- set {games::maps::tdm2::a} to true
- set {games::maps::tdm2::b} to true
- set {games::maps::tdm2::a::xoff} to -9
- set {games::maps::tdm2::a::yoff} to 9
- set {games::maps::tdm2::a::zoff} to -42
- set {games::maps::tdm2::b::xoff} to -27
- set {games::maps::tdm2::b::yoff} to 9
- set {games::maps::tdm2::b::zoff} to -8
- set {games::maps::tdm3} to true
- set {games::maps::tdm3::a} to true
- set {games::maps::tdm3::b} to true
- set {games::maps::tdm3::a::xoff} to -9
- set {games::maps::tdm3::a::yoff} to 8
- set {games::maps::tdm3::a::zoff} to -42
- set {games::maps::tdm3::b::xoff} to -27
- set {games::maps::tdm3::b::yoff} to 8
- set {games::maps::tdm3::b::zoff} to -8
- function initModes(gametype: text, amount: number):
- set {_start} to 1
- while {_start} <= {_amount}:
- set {games::match%{_start}%} to true
- set {games::match%{_start}%::type} to {_gametype}
- set {games::match%{_start}%::label} to {_start}
- set {games::match%{_start}%::state} to 0
- set {games::match%{_start}%::queued} to true
- set {games::match%{_start}%::team1} to true
- set {games::match%{_start}%::team2} to true
- set {games::match%{_start}%::team1color} to "&c"
- set {games::match%{_start}%::team2color} to "&9"
- set {games::match%{_start}%::countdown} to -1
- add 1 to {_start}
- function singleSound(sound: text, p: player, pitch: number, volume: number):
- play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at location of {_p} for {_p}
- function multiSound(sound: text, p: objects, pitch: number, volume: number):
- loop {_p::*}:
- play sound "%{_sound}%" with volume {_volume} with pitch {_pitch} at location of loop-value for loop-value
- command /games:
- trigger:
- openQueueMenu(player)
- function openQueueMenu(p: player):
- open virtual chest inventory with 6 rows named "&6Three &8- &eMatches" for {_p}
- set {_slot} to 10
- sortGreatToLow({_p}, {_slot})
- function sortGreatToLow(p: player, slot: number):
- set {_start} to 1
- loop {games::*}:
- if {games::%loop-index%::state} is set:
- set {_yeet} to size of {games::%loop-index%::queued::*}
- set {_great::%{_start}%::id} to {games::%loop-index%::label}
- set {_great::%{_start}%::theval} to {_yeet}
- set {_great::%{_start}%::state} to {games::%loop-index%::state}
- add 1 to {_start}
- set {_bubble} to size of {_great::*}
- while {_bubble} >= 1:
- set {_j} to 2
- while {_j} <= {_bubble}:
- set {_hmm} to {_j} - 1
- if {_great::%{_hmm}%::theval} > {_great::%{_j}%::theval}:
- set {_temp} to {_great::%{_hmm}%::theval}
- set {_temp2} to {_great::%{_hmm}%::id}
- set {_temp3} to {_great::%{_hmm}%::state}
- set {_great::%{_hmm}%::theval} to {_great::%{_j}%::theval}
- set {_great::%{_hmm}%::id} to {_great::%{_j}%::id}
- set {_great::%{_hmm}%::state} to {_great::%{_j}%::state}
- set {_great::%{_j}%::theval} to {_temp}
- set {_great::%{_j}%::id} to {_temp2}
- set {_great::%{_j}%::state} to {_temp3}
- add 1 to {_j}
- remove 1 from {_bubble}
- set {_init} to size of {_great::*}
- while {_init} >= 1:
- if {_great::%{_init}%::state} < 2:
- set {_itemp} to firework named "&6Match %{_great::%{_init}%::id}%" with lore "&7Players: &e%{_great::%{_init}%::theval}%/%{games::properties::maxqueue}% ||&7Status: &aOpen"
- else:
- set {_itemp} to firework named "&6Match %{_great::%{_init}%::id}%" with lore "&7Players: &e%{_great::%{_init}%::theval}%/%{games::properties::maxqueue}% ||&7Status: &cIngame"
- enchant {_itemp} with protection 1
- add "{HideFlags:63}" to {_itemp}'s item-nbt
- format gui slot {_slot} of {_p} with {_itemp} to close then run function queue({_p}, {_great::%{_init}%::id})
- add 1 to {_slot}
- if mod(({_slot} + 1), 9) = 0:
- add 2 to {_slot}
- remove 1 from {_init}
- set {_itemp} to diamond named "&6Join a match!"
- set line 1 of {_itemp}'s lore to "&7This will &aqueue &7you for the &emost popular match!"
- format gui slot 49 of {_p} with {_itemp} to close then run function queuePopular({_p})
- function queuePopular(p: player):
- set {_iter::val} to -1
- set {_iter::label} to 1
- loop {games::*}:
- if {games::%loop-index%::state} is set:
- if {games::%loop-index%::state} < 2:
- if size of {games::%loop-index%::queued::*} > {_iter::val}:
- set {_iter::val} to size of {games::%loop-index%::queued::*}
- set {_iter::label} to {games::%loop-index%::label}
- queue({_p}, {_iter::label})
- function queue(p: player, matchnum: number):
- if {games::match%{_matchnum}%::state} >= 2:
- send "&cThis match has already started!" to {_p}
- singleSound("entity.villager.no", {_p}, 1, 10)
- else:
- set {_max} to {games::properties::maxqueue}
- if size of {games::match%{_matchnum}%::queued::*} >= {_max}:
- send "&cThe queue is full!" to {_p}
- singleSound("entity.villager.no", {_p}, 1, 10)
- else:
- set {_currentcache} to {player::%{_p}%::ingame}
- if {_currentcache} = {_matchnum}:
- send "&cYou are already in this queue!" to {_p}
- singleSound("entity.villager.no", {_p}, 1, 10)
- else:
- removeFromAllQueues({_p})
- add {_p} to {games::match%{_matchnum}%::queued::*}
- set {player::%{_p}%::ingame} to {_matchnum}
- determineTeam({_p}, {_matchnum})
- generalReadyPlayer({_p})
- teleport {_p} to calculateOffsets({_matchnum}, -17.5, 30, -24.5, 90, 90, true)
- if size of {games::match%{_matchnum}%::queued::*} > 0:
- loop {games::match%{_matchnum}%::queued::*}:
- send "&e%{_p}% &7has joined the queue &8(&e%size of {games::match%{_matchnum}%::queued::*}%/%{games::properties::maxqueue}%&8)" to loop-value
- singleSound("entity.player.levelup", loop-value, 1, 10)
- if {games::match%{_matchnum}%::state} = 0:
- pingQueue({_matchnum})
- function determineTeam(p: player, matchnum: number):
- set {_size1} to size of {games::match%{_matchnum}%::team1::*}
- set {_size2} to size of {games::match%{_matchnum}%::team2::*}
- if {_size1} <= {_size2}:
- add {_p} to {games::match%{_matchnum}%::team1::*}
- set {_p} tab name to "%{games::match%{_matchnum}%::team1color}%%{_p}%"
- else:
- add {_p} to {games::match%{_matchnum}%::team2::*}
- set {_p} tab name to "%{games::match%{_matchnum}%::team2color}%%{_p}%"
- function calculateOffsets(matchnum: number, dx: number, dy: number, dz: number, yawd: number, pitchd: number, rot: boolean) :: location:
- remove 1 from {_matchnum}
- set {_x} to {games::properties::basex}
- set {_y} to {games::properties::basey}
- set {_z} to {games::properties::basez}
- set {_matchnum} to {_matchnum} * 100
- add {_matchnum} to {_x}
- add {_dx} to {_x}
- add {_dy} to {_y}
- add {_dz} to {_z}
- set {_yeet} to location ({_x}, {_y}, {_z}) in world "ul_void"
- if {_rot} is true:
- set {_yeet}'s yaw to {_yawd}
- set {_yeet}'s pitch to {_pitchd}
- return {_yeet}
- function pingQueue(matchnum: number):
- if {games::match%{_matchnum}%::state} = 0:
- if size of {games::match%{_matchnum}%::queued::*} >= {games::properties::minqueue}:
- set {games::match%{_matchnum}%::state} to 1
- startCountdown({_matchnum}, 20)
- function startCountdown(matchnum: number, times: number):
- set {games::match%{_matchnum}%::countdown} to {_times}
- loop {_times} times:
- remove 1 from {games::match%{_matchnum}%::countdown}
- wait 1 second
- if size of {games::match%{_matchnum}%::queued::*} < {games::properties::minqueue}:
- loop {games::match%{_matchnum}%::queued::*}:
- send "&cThere was not enough people to start the game." to loop-value
- singleSound("entity.villager.no", loop-value, 1, 10)
- set {games::match%{_matchnum}%::state} to 0
- else:
- set {games::match%{_matchnum}%::state} to 2
- loop {games::match%{_matchnum}%::queued::*}:
- send "&eGame &7will now &abegin!" to loop-value
- singleSound("entity.player.levelup", loop-value, 1, 10)
- resetMap({_matchnum})
- function resetMap(matchnum: number):
- set {_map} to 3
- set {_placeloc} to calculateOffsets({_matchnum}, -29, 4, -45, -1, -1, false)
- set {_x} to the x-coordinate of {_placeloc}
- set {_y} to the y-coordinate of {_placeloc}
- set {_z} to the z-coordinate of {_placeloc}
- set {_locfill} to calculateOffsets({_matchnum}, -34, -4, -49, -1, -1, false)
- set {_x1} to the x-coordinate of {_locfill}
- set {_y1} to the y-coordinate of {_locfill}
- set {_z1} to the z-coordinate of {_locfill}
- set {_locfill2} to calculateOffsets({_matchnum}, -2, 13, -1, -1, -1, false)
- set {_x2} to the x-coordinate of {_locfill2}
- set {_y2} to the y-coordinate of {_locfill2}
- set {_z2} to the z-coordinate of {_locfill2}
- console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ fill %{_x1}% %{_y1}% %{_z1}% %{_x2}% %{_y2}% %{_z2}% air"
- add 14 to {_y2}
- add 18 to {_y1}
- console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ fill %{_x1}% %{_y1}% %{_z1}% %{_x2}% %{_y2}% %{_z2}% air"
- wait 2 ticks
- console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ setblock %{_x}% %{_y}% %{_z}% structure_block 0 0 {metadata:"""",mirror:""NONE"",ignoreEntities:1b,powered:0b,seed:0L,author:""ThatOneTqnk"",rotation:""NONE"",posX:0,mode:""LOAD"",posY:0,sizeX:23,posZ:1,integrity:1.0f,showair:0b,x:449971,name:""TDM%{_map}%-1"",y:4,z:-45,id:""minecraft:structure_block"",sizeY:10,sizeZ:32,showboundingbox:1b}"
- remove 1 from {_y}
- console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ setblock %{_x}% %{_y}% %{_z}% redstone_block 0 0"
- wait 2 ticks
- console command "/execute @e[type=armor_stand,name=anchor,c=1] ~ ~ ~ fill %{_x}% %{_y}% %{_z}% %{_x}% %({_y} + 1)% %{_z}% air"
- wait 3 seconds
- set {games::match%{_matchnum}%::state} to 3
- set {_team1} to calculateOffsets({_matchnum}, {games::maps::tdm%{_map}%::a::xoff}, {games::maps::tdm%{_map}%::a::yoff}, {games::maps::tdm%{_map}%::a::zoff}, 0.001, 0.001, true)
- set {_team2} to calculateOffsets({_matchnum}, {games::maps::tdm%{_map}%::b::xoff}, {games::maps::tdm%{_map}%::b::yoff}, {games::maps::tdm%{_map}%::b::zoff}, 180, 0.001, true)
- loop {games::match%{_matchnum}%::queued::*}:
- getCommonKit(loop-value)
- loop {games::match%{_matchnum}%::team1::*}:
- teleport loop-value to {_team1}
- getArmor({games::match%{_matchnum}%::team1::*}, convertColorCode({games::match%{_matchnum}%::team1color}))
- loop {games::match%{_matchnum}%::team2::*}:
- teleport loop-value to {_team2}
- getArmor({games::match%{_matchnum}%::team2::*}, convertColorCode({games::match%{_matchnum}%::team2color}))
- function getCommonKit(person: player):
- clear the inventory of {_person}
- give 1 stone sword to {_person}
- give 1 bow to {_person}
- give 8 arrows to {_person}
- give 1 golden apple to {_person}
- give 32 oak planks to {_person}
- set {_person}'s gamemode to survival
- function getArmor(people: objects, thedye: color):
- loop {_people::*}:
- if loop-value is online:
- equip loop-value with all leather armour
- dye loop-value's helmet {_thedye}
- dye loop-value's chestplate {_thedye}
- dye loop-value's leggings {_thedye}
- dye loop-value's boots {_thedye}
- command /leave:
- trigger:
- set {_currentcache} to {player::%player%::ingame}
- if {_currentcache} > 0:
- set {_feedback} to "&7You were removed from the queue."
- teleport player to {spawn}
- else:
- set {_feedback} to "&cYou are not queued."
- removeFromAllQueues(player)
- resetPlayerData(player)
- send {_feedback}
- function removeFromAllQueues(p: player):
- set {player::%{_p}%::ingame} to -1
- loop {games::*}:
- if {games::%loop-index%::queued::*} contains {_p}:
- remove {_p} from {games::%loop-index%::queued::*}
- remove {_p} from {games::%loop-index%::team1::*}
- remove {_p} from {games::%loop-index%::team2::*}
- teamCheck({games::%loop-index%::label})
- if {games::%loop-index%::state} < 2:
- loop {games::%loop-index%::queued::*}:
- send "&a%{_p}% &7has left the queue &8(&e%size of {games::%loop-index-1%::queued::*}%/%{games::properties::maxqueue}%&8)" to loop-value-2
- on death:
- if {player::%player%::ingame} > 0:
- removeFromAllQueues(player)
- generalReadyPlayer(player)
- resetPlayerData(player)
- on respawn:
- teleport player to {spawn}
- function teamCheck(matchnum: number):
- if {games::match%{_matchnum}%::state} >= 3:
- if size of {games::match%{_matchnum}%::team1::*} = 0:
- set {_char} to "2"
- else if size of {games::match%{_matchnum}%::team2::*} = 0:
- set {_char} to "1"
- if {_char} is set:
- loop {games::match%{_matchnum}%::queued::*}:
- send "&6%{games::match%{_matchnum}%::team%{_char}%::*}% &7has won the match!" to loop-value
- singleSound("entity.player.levelup", loop-value, 1, 10)
- endGame({_matchnum})
- function endGame(matchnum: number):
- loop {games::match%{_matchnum}%::queued::*}:
- generalReadyPlayer(loop-value)
- teleport loop-value to {spawn}
- removeFromAllQueues(loop-value)
- resetPlayerData(loop-value)
- set {games::match%{_matchnum}%::state} to 0
- function convertColorCode(thecolor: text) :: color:
- if {_thecolor} is "&c":
- return red
- else if {_thecolor} is "&9":
- return blue
- else if {_thecolor} is "&a":
- return green
- else if {_thecolor} is "&e":
- return yellow
- else if {_thecolor} is "&6":
- return orange
- else:
- return white
- every 1 second:
- loop all players:
- if {player::%loop-player%::ingame} > 0:
- set {_matchnum} to {player::%loop-player%::ingame}
- wipe loop-player's sidebar
- set name of sidebar of loop-player to "&6&lTHREE"
- set score "&e&nGame %{_matchnum}%" in sidebar of loop-player to 30
- set score "&o" in sidebar of loop-player to 29
- set {_currentstate} to {games::match%{_matchnum}%::state}
- if {_currentstate} = 0:
- set score "&7Waiting:" in sidebar of loop-player to 28
- set score "&e%size of {games::match%{_matchnum}%::queued::*}%/&e%{games::properties::minqueue}% players" in sidebar of loop-player to 27
- else if {_currentstate} = 1:
- if {games::match%{_matchnum}%::countdown} > 0:
- set {_postfix} to "s"
- if {games::match%{_matchnum}%::countdown} = 1:
- set {_postfix} to ""
- set score "&7Starting:" in sidebar of loop-player to 28
- set score "&e%{games::match%{_matchnum}%::countdown}% &esecond%{_postfix}%" in sidebar of loop-player to 27
- if mod({games::match%{_matchnum}%::countdown}, 5) = 0:
- singleSound("ui.button.click", loop-player, 1, 10)
- else if {_currentstate} is 3:
- set score "&6Three &8» &e3v3 PvP" in sidebar of loop-player to 28
- else if {_currentstate} is 2:
- set score "&cMap resetting..." in sidebar of loop-player to 28
- set score "&2" in sidebar of loop-player to 26
- set {_num} to 25
- set score "&7Team 1:" in sidebar of loop-player to {_num}
- loop {games::match%{_matchnum}%::team1::*}:
- remove 1 from {_num}
- set score "%{games::match%{_matchnum}%::team1color}%%loop-value-2%" in sidebar of loop-value-1 to {_num}
- remove 1 from {_num}
- set score "&3" in sidebar of loop-player to {_num}
- remove 1 from {_num}
- set score "&7Team 2:" in sidebar of loop-player to {_num}
- loop {games::match%{_matchnum}%::team2::*}:
- remove 1 from {_num}
- set score "%{games::match%{_matchnum}%::team2color}%%loop-value-2%" in sidebar of loop-value-1 to {_num}
- remove 1 from {_num}
- set score "&c" in sidebar of loop-player to {_num}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement