Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on load:
- if {joincounter} is not set:
- set {joincounter} to 0
- set {matchcounter} to 0
- resetGameCore()
- set {_gopts::disp} to "&6The Bridges"
- set {_gopts::maxqueue} to 999
- set {_gopts::minqueue} to 2
- set {_gopts::qc} to "&d"
- initGames("bridges", 1, {_gopts::*})
- loop all players:
- resetPlayerData(loop-player)
- on join:
- set {_res} to isNew(player)
- set {_append} to ""
- if {_res} is true:
- add 1 to {joincounter}
- set {_append} to " &d[NEW]"
- set {_msg} to "&8[&a+&8] &7%player%%{_append}%"
- set join message to {_msg}
- resetPlayerData(player)
- function isNew(p: player) :: boolean:
- set {_yeet} to false
- set {_uuid} to uuid of {_p}
- if {leplayer::%{_uuid}%} is not set:
- set {_yeet} to true
- return {_yeet}
- function resetPlayerData(p: player):
- set {_uuid} to uuid of {_p}
- if {leplayer::%{_uuid}%} is not set:
- set {leplayer::%{_uuid}%} to {_p}
- set {leplayer::%{_uuid}%::coins} to 0
- set {leplayer::%{_uuid}%::xp} to 0
- if {player::%{_p}%} is not set:
- set {player::%{_p}%} to {_uuid}
- set {player::%{_p}%::ingame} to 0
- delete {player::%{_p}%::gametype}
- set {_p} tab name to "&7%{_p}%"
- function resetGameCore():
- clear {games::*}
- set {games::repo} to true
- set {games::matches} to true
- function initGames(game: text, count: number, gopts: objects):
- set {games::repo::%{_game}%} to true
- set {games::repo::%{_game}%::disp} to {_gopts::1}
- set {games::repo::%{_game}%::maxqueue} to {_gopts::2}
- set {games::repo::%{_game}%::minqueue} to {_gopts::3}
- set {games::repo::%{_game}%::qc} to {_gopts::4}
- set {_start} to 1
- while {_start} <= {_count}:
- add 1 to {matchcounter}
- set {games::matches::match%{_start}%} to true
- set {games::matches::match%{_start}%::label} to {matchcounter}
- set {games::matches::match%{_start}%::gametype} to {_game}
- set {games::matches::match%{_start}%::state} to 0
- set {games::matches::match%{_start}%::queued} to true
- add 1 to {_start}
- command /test:
- trigger:
- queue("bridges", player)
- function queue(game: text, p: player):
- if {player::%{_p}%::gametype} is set:
- send "&cYou are already in a game/queue!" to {_p}
- singleSound("entity.villager.no", {_p}, 1, 10)
- stop
- set {_matchnum} to findAvailableMatch({_game})
- set {_disp} to {games::repo::%{_game}%::disp}
- if {_matchnum} < 0:
- send "&cThere are no available matches for %{_disp}%" to {_p}
- singleSound("entity.villager.no", {_p}, 1, 10)
- stop
- add {_p} to {games::matches::match%{_matchnum}%::queued::*}
- set {_qc} to {games::repo::%{_game}%::qc}
- set {_disp} to {games::repo::%{_game}%::disp}
- set {_p} tab name to "%{_qc}%%{_p}%"
- set {player::%{_p}%::gametype} to {_game}
- set {player::%{_p}%::ingame} to {_matchnum}
- send "&7You have &ajoined the queue &7for %{_disp}%!" to {_p}
- singleSound("entity.player.levelup", {_p}, 1.4, 10)
- pingQueue({_matchnum})
- function pingQueue(matchnum: number):
- set {_gametype} to {games::matches::match%{_matchnum}%::gametype}
- if {games::matches::match%{_matchnum}%::state} = 0:
- if size of {games::matches::match%{_matchnum}%::queued::*} >= {games::repo::%{_gametype}%::minqueue}:
- set {games::matches::match%{_matchnum}%::state} to 1
- set {_start} to 20
- set {_disp} to {games::repo::%{_gametype}%::disp}
- loop 20 times:
- set {_gamer} to false
- if {_start} > 0:
- if mod({_start}, 5) = 0:
- set {_gamer} to true
- else if {_start} <= 5:
- set {_gamer} to true
- if {_gamer} is true:
- set {_app} to "s"
- if {_start} = 1:
- set {_app} to ""
- sendToQueued("%{_disp}% &7will begin in &3%{_start}% &bsecond%{_app}%", {_matchnum})
- playToQueued("block.note_block.hat", {_matchnum}, 1, 10)
- remove 1 from {_start}
- wait 1 second
- sendToQueued("%{_disp}% &7will now &bbegin", {_matchnum})
- playToQueued("entity.player.levelup", {_matchnum}, 1.4, 10)
- if size of {games::matches::match%{_matchnum}%::queued::*} < {games::repo::%{_gametype}%::minqueue}:
- sendToQueued("&cNot enough players for %{_disp}%", {_matchnum})
- playToQueued("entity.villager.no", {_matchnum}, 1, 10)
- set {games::matches::match%{_matchnum}%::state} to 0
- stop
- set {games::matches::match%{_matchnum}%::state} to 2
- disperseGamerMoment({_matchnum})
- function disperseGamerMoment(matchnum: number):
- set {_gametype} to {games::matches::match%{_matchnum}%::gametype}
- if {_gametype} is "bridges":
- brRun({_matchnum})
- function findAvailableMatch(game: text) :: number:
- loop {games::matches::*}:
- if {games::matches::%loop-index%::gametype} is {_game}:
- if {games::matches::%loop-index%::state} <= 1:
- if size of {games::matches::%loop-index%::queued::*} < {games::repo::%{_game}%::maxqueue}:
- return {games::matches::%loop-index%::label}
- return -1
- function sendToQueued(msg: text, matchnum: number):
- loop {games::matches::match%{_matchnum}%::queued::*}:
- send {_msg} to loop-value
- function playToQueued(sound: text, matchnum: number, pitch: number, volume: number):
- multiSound({_sound}, {games::matches::match%{_matchnum}%::queued::*}, {_pitch}, {_volume})
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement