Files
zrzuty_kompletny_test (1).sk
Code
1 195
zrzuty_kompletny_test (1).sk
# ZRZUTY.SK - Skript 2.12.2
# Wersja do wgrania ZAMIAST starego pliku zrzuty_kompletny_test.sk
#
# Komendy:
# /zrzut
# /zrzut czas <sekundy>
# /zrzut info
# /zrzut edit
# /zrzut usun
#
# Edycja: /zrzut edit otwiera aktualna skrzynie zrzutu.
# Po zamknieciu skrzyni zmiany w loot pozostaja.
options:
czas-startowy: 60
command /zrzut [<text>] [<number>]:
permission: airdrop.admin
permission message: "&cNie masz uprawnienia do tej komendy."
trigger:
if arg-1 is not set:
if {zrzut.aktywny} is true:
send "&cZrzut juz istnieje. Uzyj /zrzut usun." to player
stop
set {_loc} to location of player
add 1 to y-coordinate of {_loc}
if block at {_loc} is not air:
send "&cNad Toba nie ma wolnego miejsca na skrzynie." to player
stop
# Sasiednia skrzynia moglaby otworzyc zrzut jako podwojna skrzynie.
loop blocks in radius 1 around block at {_loc}:
if loop-block is chest:
send "&cNie mozna utworzyc zrzutu obok innej skrzyni." to player
stop
set block at {_loc} to chest
set {_loc} to location of block at {_loc}
set {zrzut.lokacja} to {_loc}
set {zrzut.aktywny} to true
set {zrzut.odblokowany} to false
if {zrzut.czas} is not set:
set {zrzut.czas} to {@czas-startowy}
set {zrzut.pozostalo} to {zrzut.czas}
set {zrzut.czas.blokady} to {zrzut.czas}
# Domyslny loot - mozna go pozniej zmienic przez /zrzut edit.
set slot 0 of inventory of block at {_loc} to 5 diamonds
set slot 1 of inventory of block at {_loc} to 8 golden apples
set slot 2 of inventory of block at {_loc} to 16 ender pearls
set slot 3 of inventory of block at {_loc} to 4 golden carrots
set slot 4 of inventory of block at {_loc} to 3 experience bottles
set slot 5 of inventory of block at {_loc} to 16 cooked beef
broadcast "&6&l✦ ZRZUT ZAOPATRZENIA! ✦"
broadcast "&eZrzut pojawil sie na koordynatach: &f%x-coordinate of {_loc}%, %y-coordinate of {_loc}%, %z-coordinate of {_loc}%"
broadcast "&eSkrzynia otworzy sie za &f%{zrzut.pozostalo}% &esekund."
if {zrzut.pozostalo} <= 0:
set {zrzut.odblokowany} to true
broadcast "&a&lZRZUT OTWARTY! &eMozecie juz otwierac skrzynie."
else:
zrzutBossbar()
stop
if arg-1 is "czas":
if arg-2 is not set:
send "&eUzycie: /zrzut czas <sekundy>" to player
stop
if arg-2 < 0:
send "&cCzas nie moze byc ujemny." to player
stop
if arg-2 is not rounded down arg-2:
send "&cPodaj pelna liczbe sekund." to player
stop
set {zrzut.czas} to arg-2
send "&aCzas blokady nastepnego zrzutu ustawiono na &f%arg-2% &asekund." to player
stop
if arg-1 is "edit":
if {zrzut.aktywny} is not true:
send "&cNie ma aktywnego zrzutu do edytowania." to player
stop
if block at {zrzut.lokacja} is not chest:
send "&cNie znaleziono skrzyni zrzutu." to player
stop
set {zrzut.edytuje.%uuid of player%} to true
open inventory of block at {zrzut.lokacja} to player
send "&aEdytujesz loot zrzutu. Wloz lub wyjmij itemy i zamknij skrzynie, aby zakonczyc." to player
stop
if arg-1 is "info":
if {zrzut.aktywny} is true:
send "&6Zrzut: &aaktywny" to player
send "&ePozostaly czas: &f%{zrzut.pozostalo}% sekund" to player
send "&eKoordynaty: &f%x-coordinate of {zrzut.lokacja}%, %y-coordinate of {zrzut.lokacja}%, %z-coordinate of {zrzut.lokacja}%" to player
if {zrzut.odblokowany} is true:
send "&aSkrzynia jest odblokowana." to player
else:
send "&cSkrzynia jest zablokowana." to player
else:
send "&7Nie ma aktywnego zrzutu." to player
stop
if arg-1 is "usun":
if {zrzut.aktywny} is not true:
send "&cNie ma aktywnego zrzutu." to player
stop
set block at {zrzut.lokacja} to air
delete {zrzut.lokacja}
delete {zrzut.aktywny}
delete {zrzut.odblokowany}
delete {zrzut.pozostalo}
execute console command "bossbar set zrzuty:blokada players"
broadcast "&cZrzut zostal usuniety przez administratora."
stop
send "&6Komendy zrzutu:" to player
send "&e/zrzut &7- stworz zrzut" to player
send "&e/zrzut czas <sekundy> &7- ustaw czas nastepnego zrzutu" to player
send "&e/zrzut info &7- informacje o zrzucie" to player
send "&e/zrzut edit &7- edytuj zawartosc skrzyni" to player
send "&e/zrzut usun &7- usun zrzut" to player
# Interakcja z blokiem jest blokowana przed otwarciem ekwipunku.
on right click:
if {zrzut.aktywny} is true:
if {zrzut.odblokowany} is not true:
if event-block is block at {zrzut.lokacja}:
cancel event
send "&cZrzut jest zablokowany! Pozostalo &f%{zrzut.pozostalo}% &csekund." to player
# Nie pozwalaj laczyc zablokowanego zrzutu z druga skrzynia.
on place of chest:
if {zrzut.aktywny} is true:
if {zrzut.odblokowany} is not true:
if world of event-block is world of {zrzut.lokacja}:
if distance between location of event-block and {zrzut.lokacja} <= 1:
cancel event
send "&cNie mozesz postawic skrzyni przy zablokowanym zrzucie!" to player
# Koniec trybu edycji po zamknieciu skrzyni.
on inventory close:
if {zrzut.edytuje.%uuid of player%} is true:
delete {zrzut.edytuje.%uuid of player%}
send "&aEdycja zrzutu zakonczona. Zmiany zostaly zachowane." to player
# Nie mozna zniszczyc skrzyni przed koncem blokady.
on break:
if {zrzut.aktywny} is true:
if {zrzut.odblokowany} is not true:
if event-block is block at {zrzut.lokacja}:
cancel event
send "&cNie mozesz zniszczyc zrzutu przed koncem blokady!" to player
on load:
if {zrzut.czas} is not set:
set {zrzut.czas} to {@czas-startowy}
execute console command "bossbar remove zrzuty:blokada"
execute console command "bossbar add zrzuty:blokada {""text"":""Zrzut""}"
execute console command "bossbar set zrzuty:blokada color yellow"
if {zrzut.aktywny} is true:
if {zrzut.odblokowany} is not true:
zrzutBossbar()
function zrzutBossbar():
set {_x} to x-coordinate of {zrzut.lokacja}
set {_y} to y-coordinate of {zrzut.lokacja}
set {_z} to z-coordinate of {zrzut.lokacja}
set {_procent} to 100
if {zrzut.czas.blokady} > 0:
set {_procent} to rounded down ({zrzut.pozostalo} / {zrzut.czas.blokady} * 100)
if {_procent} > 100:
set {_procent} to 100
if {_procent} < 0:
set {_procent} to 0
execute console command "bossbar set zrzuty:blokada name {""text"":""Zrzut: %{_x}%, %{_y}%, %{_z}% | Blokada: %{zrzut.pozostalo}% s"",""color"":""yellow""}"
execute console command "bossbar set zrzuty:blokada value %{_procent}%"
execute console command "bossbar set zrzuty:blokada players @a"
every 1 second:
if {zrzut.aktywny} is true:
if {zrzut.odblokowany} is not true:
if {zrzut.pozostalo} > 0:
remove 1 from {zrzut.pozostalo}
if {zrzut.pozostalo} <= 0:
set {zrzut.pozostalo} to 0
set {zrzut.odblokowany} to true
execute console command "bossbar set zrzuty:blokada players"
broadcast "&a&lZRZUT OTWARTY! &eMozecie juz otwierac skrzynie."
else:
zrzutBossbar()