JIT
creating a money management and brush tool script for a game
# =============================== # SYSTEM MONEY SMP – SKRYPT # =============================== # Zmienne: # {money::%uuid of player%} – saldo gracza # ------------------------------- # KOMENDY POKAZUJĄCE STAN KASY # ------------------------------- command /money: trigger: send "&6💰 Masz: &a%{money::%uuid of player%}%&6 zł" to player command /ile: trigger: send "&6💰 Masz: &a%{money::%uuid of player%}%&6 zł" to player # Komenda testowa (dla administratora) – dodaje określoną ilość kasy command /dajkase <number>: permission: op trigger: add arg-1 to {money::%uuid of player%} send "&aDodano %arg-1% zł!" to player # ------------------------------- # KOMENDA DAWANIA BRUSHA # ------------------------------- command /dajbrusha [<text>]: trigger: # Dozwolone rozmiary brushy set {_sizes::*} to "1x1", "2x2", "3x3", "4x4", "5x5" if arg-1 is not set: send "&cUżycie: /dajbrusha <1x1/2x2/3x3/4x4/5x5>" to player stop if arg-1 is not in {_sizes::*}: send "&cDozwolone rozmiary: 1x1, 2x2, 3x3, 4x4, 5x5" to player stop give player a blaze rod named "&6🪄 Brush &7(&e%arg-1%&7)" with lore "&7Rozmiar kopania: &e%arg-1%" send "&aOtrzymałeś Brush &e%arg-1%" to player # ------------------------------- # USTAWIENIE STARTOWEJ KASY # ------------------------------- on join: if {money::%uuid of player%} is not set: set {money::%uuid of player%} to 0 # ------------------------------- # DZIAŁANIE BRUSHA – KOPANIE # ------------------------------- on rightclick: # Sprawdzamy, czy gracz trzyma Blaze Roda if player's tool is a blaze rod: # Sprawdzamy, czy nazwa narzędzia zawiera "Brush" if name of player's tool contains "Brush": cancel event # Ustalamy rozmiar – domyślnie 1 (czyli 1x1) set {_size} to 1 if name of player's tool contains "2x2": set {_size} to 2 if name of player's tool contains "3x3": set {_size} to 3 if name of player's tool contains "4x4": set {_size} to 4 if name of player's tool contains "5x5": set {_size} to 5 # Pobieramy blok, w który patrzy gracz set {_target} to targeted block of player if {_target} is not set: send "&cNie widzisz celu!" to player stop # Obliczamy offset – aby obszar był centrowany na celu. # Przykładowo: dla 3x3, offset wynosi floor(3/2)=1, czyli od -1 do 1. set {_offset} to floor({_size} / 2) # Pętla – przeglądamy wszystkie bloki w płaszczyźnie poziomej wokół bloku docelowego. loop {_x} from -{_offset} to {_offset}: loop {_z} from -{_offset} to {_offset}: # Obliczamy nową lokalizację – Y pozostaje taki sam jak u celu. set {_loc} to location of {_target} set {_nx} to x-coordinate of {_loc} + {_x} set {_ny} to y-coordinate of {_loc} set {_nz} to z-coordinate of {_loc} + {_z} set {_b} to block at {_nx}, {_ny}, {_nz} in world of {_loc} # Jeśli blok nie jest powietrzem if {_b} is not air: # Sprawdzamy, czy to cobblestone – jeśli tak, losujemy drop pieniężny. if type of {_b} is cobblestone: # Losujemy liczbę 1-100. set {_rand} to a random integer between 1 and 100 if {_rand} <= 5: add 0.01 to {money::%uuid of player%} send "&a💵 Znalazłeś 1 grosz!" to player else if {_rand} <= 7: add 1 to {money::%uuid of player%} send "&a💵 Znalazłeś 1 zł!" to player else if {_rand} <= 8: add 2 to {money::%uuid of player%} send "&a💵 Znalazłeś 2 zł!" to player # Zmieniamy blok na powietrze (kopanie) set block at {_nx}, {_ny}, {_nz} in world of {_loc} to air
Updated files
v1