options: world: oxMap #Don't touch cw: "plugins/OX/config.yml" cs: "../../OX/config.yml" mw: "plugins/OX/messages.yml" ms: "../../OX/messages.yml" on script load: if file {@cw} is not exists: set yaml value "minPlayers" from {@cs} to 2 set yaml value "reward" from {@cs} to "diamond" set yaml value "amountOfQuestion" from {@cs} to "MAX" add "16:00" to yaml list "godziny" from {@cs} add "19:00" to yaml list "godziny" from {@cs} add "21:00" to yaml list "godziny" from {@cs} add "Czy 'przytulenie' kaktusa zadaje obrazenia?" to yaml list "pytanie.tak" from {@cs} add "Czy ruda lazurytu jest mozliwa do wydobycia przy uzyciu kamiennego kilofa?" to yaml list "pytanie.tak" from {@cs} add "Czy creeper'y uciekaja przed ocelot'ami?" to yaml list "pytanie.tak" from {@cs} add "Czy kaktus jest odporny na dzialanie ognia?" to yaml list "pytanie.tak" from {@cs} add "Czy glowstone mozna zdobyc poza nether'em?" to yaml list "pytanie.tak" from {@cs} add "Czy bieganie/skakanie po brodawkach je niszczy?" to yaml list "pytanie.nie" from {@cs} add "Czy Ocelot naturalnie spawnuje sie poza biomem dzunglowym?" to yaml list "pytanie.nie" from {@cs} add "Czy siodla mozna uzywac na krowie?" to yaml list "pytanie.nie" from {@cs} add "Czy slime wystepuja naturalnie na bagnach?" to yaml list "pytanie.nie" from {@cs} set {OX::conf::godz::*} to yaml list "godziny" from {@cs} set {OX::conf::godz} to size of {OX::conf::godz::*} if file {@mw} is not exists: set yaml value "recordsStart" from {@ms} to "&c* &6Zapisy na event OX sie rozpoczely.%nl%&c* &7Wpisz &c/ox&7, aby sie zapisac." set yaml value "recordsStop" from {@ms} to "&c* &6Zapisy na event OX sie zakonczyly." set yaml value "gameNoStarted" from {@ms} to "&c* &6Event OX nie wystartowal. Za malo graczy sie zapisalo." set yaml value "gameNoStartedNoQuestion" from {@ms} to "&c* &6Event OX nie wystartowal. Brak pytan w puli." set yaml value "gameStarted" from {@ms} to "&c* &6Event OX rozpoczal sie." set yaml value "gameStopedByOneWin" from {@ms} to "&c* &7Event OX zakonczyl sie. Zwyciezyl gracz &3{PLAYER}" set yaml value "gameStopedByNoWin" from {@ms} to "&c* &7Event OX zakonczyl sie. Nikt nie wygral." set yaml value "gameStopedByMoreWin" from {@ms} to "&c* &7Event OX zakonczyl sie. Wygralo {AMOUNT} graczy." set yaml value "gameStopedByAdmin" from {@ms} to "&c* &7Event OX zakonczyl sie. Zostal zatrzymany przez admina." set yaml value "gameSendQuestion" from {@ms} to "%nl%&c* &7Pytanie:%nl%&c* &6{QUESTION}&r%nl%" set yaml value "gameWait3" from {@ms} to "&e{TIME}" set yaml value "gameWait2" from {@ms} to "&6{TIME}" set yaml value "gameWait1" from {@ms} to "&4{TIME}" set yaml value "gamePlayerLeft" from {@ms} to "&c* &7Pozostalo graczy: {AMOUNT}" set yaml value "gamePlayerOut" from {@ms} to "&c* &6Spadles!" set yaml value "cmdOxAdminNoArgs" from {@ms} to "&a/ox &8- &7dolaczasz do OX.%nl%&a/ox start &8- &7startujesz OX.%nl%&a/ox godziny &8- &7godziny aktywowania eventu OX" set yaml value "cmdOxAdminStartAbort" from {@ms} to "&7Juz jest aktywowane rozpoczecie OX." set yaml value "cmdOxAdminStart" from {@ms} to "&c* &7Za niecala minute rozpoczna sie zapisy na OX!" set yaml value "cmdOxInGame" from {@ms} to "&6Juz jestes zapisany na OX!" set yaml value "cmdOxToGame" from {@ms} to "&7Zapisales sie na OX!" set yaml value "cmdOxHours" from {@ms} to "&c* &7Godziny aktywowania zapisow:" set {OX::game::inGame} to location at 0.5, 65.5, 0.5 of the world "{@world}" set {OX::game::lobby} to location at 0.5, 82.5, 0.5 of the world "{@world}" set {_i} to 1 loop 5 times: loop 11 times: set {OX::game::white::%{_i}%} to location at 3.5 - loop-number-1, 64.5, 6.5 - loop-number-2 in world "{@world}" add 1 to {_i} set {_i} to 1 loop 3 times: loop 11 times: set {OX::game::red::%{_i}%} to location at 6.5 - loop-number-1, 64.5, 6.5 - loop-number-2 in world "{@world}" add 1 to {_i} set {_i} to 1 loop 3 times: loop 11 times: set {OX::game::green::%{_i}%} to location at -1.5 - loop-number-1, 64.5, 6.5 - loop-number-2 in world "{@world}" add 1 to {_i} #---Functions--- function clearFloor(floor: text): if {_floor} is "white" or "red" or "green": loop {OX::game::%{_floor}%::*}: set block at loop-value to air stop function setFloor(floor: text): if {_floor} is "white" or "red" or "green": if {_floor} is "green": set {_block} to "light_green_wool_block" else: set {_block} to "%{_floor}%_wool_block" loop {OX::game::%{_floor}%::*}: set {_block} to "%{_block}%" parsed as material set block at loop-value to {_block} function tpOXInGame(): loop {OX::game::players::*}: teleport loop-value to {OX::game::inGame} function sendOxQuestion(quest: text): set {_qM} to yaml value "gameSendQuestion" from {@ms} replace all "{QUESTION}" with "%{_quest}%" in {_qM} broadcast coloured "%{_qM}%" to "{@world}" function sendOxWait(time: integer): set {_tM} to yaml value "gameWait%{_time}%" from {@ms} replace all "{TIME}" with "%{_time}%" in {_tM} broadcast coloured "%{_tM}%" to "{@world}" function stopOX(): if size of {OX::game::players::*} is larger than 0: loop {OX::game::players::*}: set {_p} to "%loop-value%" parsed as offlineplayer teleport {_p} to {OX::game::lobby} clear {OX::game::players::*} clear {OX::game::records} broadcast coloured "%yaml value ""gameStopedByAdmin"" from "{@ms}"%" function startOxGame(): set {_qY::*} to yaml list "pytanie.tak" from {@cs} set {_qN::*} to yaml list "pytanie.nie" from {@cs} set {_qS} to size of {_qY::*} + size of {_qN::*} if {_qS} is smaller than 1: broadcast coloured "%yaml value ""gameNoStartedNoQuestion"" from "{@ms}"%" stop if "%yaml value ""amountOfQuestion"" from "{@cs}"%" is not "MAX": set {_qS} to yaml value "amountOfQuestion" from {@cs} set {_qS} to {_qS} parsed as integer if {_qS} is not integer: send "&c* &7Blad configu 'amountOfQuestion': %nl%&c%last parse error%" to console set {_qS} to size of {_qY::*} + size of {_qN::*} tpOXInGame() set {_reward} to "%yaml value ""reward"" from "{@cs}"%" set {_reward} to {_reward} parsed as item type if {_reward} is not item type: send "&c* &7Blad configu 'reward':%nl%%last parse error%" to console loop {_qS} times: clear {_q} clear {_q.a} if {_q} is not set: loop 100 times: if {_q} is set: exit loop chance of 50%: set {_q} to random text out of {_qY::*} set {_q.a} to "y" remove {_q} from {_qY::*} exit loop set {_q} to random text out of {_qN::*} set {_q.a} to "n" remove {_q} from {_qN::*} exit loop sendOxQuestion({_q}) wait 7 second loop 3 times: sendOxWait(3-(loop-number-2)+1) wait 1 second clearFloor("white") wait 3 second if {_q.a} is "y": clearFloor("red") if {_q.a} is "n": clearFloor("green") wait 2 second setFloor("red") setFloor("white") setFloor("green") tpOXInGame() if size of {OX::game::players::*} is smaller than 1: broadcast coloured "%yaml value ""gameStopedByNoWin"" from "{@ms}"%" delete {OX::game::players::*} stop if size of {OX::game::players::*} is 1: loop {OX::game::players::*}: set {_p} to "%loop-value-2%" parsed as offlineplayer teleport {_p} to {OX::game::lobby} give {_reward} to {_p} exit loop set {_geop} to yaml value "gameStopedByOneWin" from {@ms} replace all "{PLAYER}" with "%{_p}%" in {_geop} broadcast coloured "%{_geop}%" delete {OX::game::players::*} stop tpOXInGame() set {_gpl} to yaml value "gamePlayerLeft" from {@ms} replace all "{AMOUNT}" with "%size of {OX::game::players::*}%" in {_gpl} broadcast coloured "%{_gpl}%" to "{@world}" set {_ge} to yaml value "gameStopedByMoreWin" from {@ms} replace all "{AMOUNT}" with "%size of {OX::game::players::*}%" in {_ge} broadcast coloured "%{_ge}%" loop {OX::game::players::*}: set {_p} to "%loop-value%" parsed as offlineplayer teleport {_p} to {OX::game::lobby} give {_reward} to {_p} delete {OX::game::players::*} stop every 1 second: #broadcast "%hour% %minutes% %seconds%" loop {OX::conf::godz::*}: set {_lv} to "%loop-value%" set {_i} to 0 loop 10 times: replace all "0%{_i}%" with "%{_i}%" in {_lv} add 1 to {_i} if "%{_lv}%:0" is "%hour%:%minutes%:%seconds%": set {_i} to size of {OX::conf::godz::*} if {OX::conf::godz} is smaller than {_i}: delete {OX::conf::godz::%{_i}%} set {OX::game::records} to true broadcast coloured "%yaml value ""recordsStart"" from "{@ms}"%" wait 30 seconds broadcast coloured "%yaml value ""recordsStop"" from "{@ms}"%" clear {OX::game::records} if size of {OX::game::players::*} is smaller than "%yaml value ""minPlayers"" from "{@cs}"%" parsed as integer: broadcast coloured "%yaml value ""gameNoStarted"" from "{@ms}"%" loop {OX::game::players::*}: execute console command "spawn %loop-value-2%" clear {OX::game::players::*} stop startOxGame() stop command /ox []: trigger: if {OX::game::records} is set: if {OX::game::players::*} contains player: send coloured "%yaml value ""cmdOxInGame"" from "{@ms}"%" stop add player to {OX::game::players::*} teleport player to {OX::game::lobby} send coloured "%yaml value ""cmdOxToGame"" from "{@ms}"%" stop if player has permission "ox.admin": if arg 1 is not set: send coloured "%yaml value ""cmdOxAdminNoArgs"" from "{@ms}"%" stop if arg 1 is "start": set {_t} to "%hour%:%minutes+1%" loop {OX::conf::godz::*}: if "%loop-value%" is "%{_t}%": send coloured "%yaml value ""cmdOxAdminStartAbort"" from "{@ms}"%" stop add {_t} to {OX::conf::godz::*} broadcast coloured "%yaml value ""cmdOxAdminStart"" from "{@ms}"%" stop if arg 1 is "godziny": send coloured "%yaml value ""cmdOxHours"" from "{@ms}"%" loop {OX::conf::godz::*}: send coloured "&a%loop-value%" stop stop send coloured "%yaml value ""cmdOxHours"" from "{@ms}"%" loop {OX::conf::godz::*}: send coloured "&a%loop-value%" stop on damage: if victim's world is "{@world}": cancel event on break: if player is op: stop if player's world is "{@world}": cancel event on place: if player is op: stop if player's world is "{@world}": cancel event on any move: if player's world is "{@world}": if y-location of player is smaller than 60: remove player from {OX::game::players::*} send coloured "%yaml value ""gamePlayerOut"" from "{@ms}"%" teleport player to {OX::game::lobby} stop