#1 - [dzialka] #2 - Nazwa dzialki (Wlasciciel:) #3 - Cena dzialki (%player%) #4 - Status function changeGoldToBuy(p: player, i: integer) :: boolean: set {_goldBlocks} to amount of gold block in {_p}'s inventory set {_gold} to amount of gold ingot in {_p}'s inventory if "%({_goldBlocks} * 9) + {_gold}%" parsed as integer is larger than or equal to {_i}: if {_gold} is larger than or equal to {_i}: set {_gi} to "%{_i}% gold ingot" parsed as item type remove {_gi} from {_p}'s inventory return true stop set {_giS} to "%{_gold}% gold ingot" parsed as item type remove {_giS} from {_p}'s inventory set {_d} to {_i} - {_gold} set {_gbC} to ceil({_d}/9) set {_gb} to "%{_gbC}% gold block" parsed as item type remove {_gb} from {_p}'s inventory set {_giR} to ({_gbC}*9)-{_d} set {_gi} to "%{_giR}% gold ingot" parsed as item type give {_gi} to {_p}'s inventory return true stop return false function changeGoldToSell(p: player, i: integer): set {_gbC} to floor({_i}/9) set {_gb} to "%{_gbC}% gold block" parsed as item type give {_gb} to {_p}'s inventory set {_gi} to "%{_i}-({_gbC}*9)% gold ingot" parsed as item type give {_gi} to {_p}'s inventory function setDzialka(p: player, l: location): set {_sign} to block at {_l} loop 4 times: set {_sign::%loop-number%} to uncoloured line loop-number of {_sign} replace all " zlota" in {_sign::3} with "" set {_sign::3} to {_sign::3} parsed as integer set {_amount} to "%{_sign::3}% gold ingot" parsed as item type if {dzialka::%{_p}%} is set: send "&c* &7Juz posiadasz dzialke." to {_p} stop if changeGoldToBuy({_p}, {_sign::3}) is true: set {dzialka::%{_p}%} to {_l} set {dzialka::%{_p}%::name} to {_sign::2} set {dzialka::%{_p}%::price} to {_sign::3} set {dzialka::%{_p}%::world} to {_p}'s world execute console command "region addowner -w %{_p}'s world% %{_sign::2}% %{_p}%" send "&c* &aKupiles dzialke %{_sign::2}%" to {_p} set line 2 of {_sign} to "Wlasciciel:" set line 3 of {_sign} to "%{_p}%" set line 4 of {_sign} to "%now%" stop send "&c* &7Nie posiadasz %{_sign::3}% zlota." to {_p} stop function clearDzialka(p: player): set {_sign} to block at {dzialka::%{_p}%} set line 2 of {_sign} to "%{dzialka::%{_p}%::name}%" set line 3 of {_sign} to "&6%{dzialka::%{_p}%::price}% zlota" set line 4 of {_sign} to "&aWolna" set {_recive} to ceil({dzialka::%{_p}%::price}/2) changeGoldToSell({_p}, {_recive}) send "&c* &7Sprzedales dzialke %{dzialka::%{_p}%::name}%" to {_p} set {_members::*} to members of "%{dzialka::%{_p}%::name}%" parsed as region loop {_members::*}: execute console command "rg removemember -w %{_p}'s world% %{dzialka::%{_p}%::name}% %loop-value%" execute console command "rg removeowner -w %{_p}'s world% %{dzialka::%{_p}%::name}% %{_p}%" clear {dzialka::%{_p}%} clear {dzialka::%{_p}%::name} clear {dzialka::%{_p}%::price} clear {dzialka::%{_p}%::world} stop on sign change: if line 1 is "dzialka": if player has permission "dzialka.stworz": if line 3 is not empty: if "%line 3%" parsed as integer is integer: set line 3 to "&6%line 3% zlota" else: set event-block to air send "&c* &7W linijce 3 wpisz liczbe (cene)" stop set {_r} to subtext of "%regions at event-block%" from index 1 to first index of " in" in "%regions at event-block%" - 1 set line 2 to {_r} set line 1 to "[&2Dzialka&r]" set line 4 to "&aWolna" stop send "&c* &7Podaj cene dzialki." set event-block to air stop on rightclick on sign: if line 1 contains "Dzialka": if "%uncoloured line 3%" is "%player%": open chest with 1 row named "&6Zarzadzanie dzialka" to player wait 2 tick set player's current inventory's slot 4 to bedrock named "&c&lSprzedaj dzialke" stop if line 4 contains "wolna": setDzialka(player, location of event-block) on inventory click: if "%inventory name of player's current inventory%" contains "Zarzadzanie dzialka": if slot is smaller than 0: stop cancel event if slot is 4: clearDzialka(player) close player's inventory stop command /dzialka [] []: aliases: p trigger: if {dzialka::%player%} is set: if arg 1 is not set: send "&a/dzialka dodaj &8- &7dodajesz kolege do dzialki." send "&a/dziala wywal &8- &7usuwasz kolege z dzialki." send "&a/dzialka przepisz &8- &7oddajesz dzialke dla kolegi." send "&a/dzialka members &8- &7pokazuje uzytkownikow twojej dzialki." stop if arg 1 is "del": clear {dzialka::%player%} clear {dzialka::%player%::name} clear {dzialka::%player%::price} clear {dzialka::%player%::world} send "skasowano." stop if arg 1 is "members": set {_members::*} to members of "%{dzialka::%player%::name}%" parsed as region if size of {_members::*} is larger than 0: send "&c* &7Uzytkownicy twojej dzialki %{dzialka::%player%::name}%" loop {_members::*}: set {_p} to "%loop-value%" parsed as offlineplayer set {_} to "&c" if {_p} is online: set {_} to "&a" send "%{_}%%loop-value%" stop send "&c* &7Nikogo nie masz dodanego do swojej dzialki." stop if arg 1 is "wywal": if arg 2 is set: set {_p} to "%arg 2%" parsed as offlineplayer set {_members::*} to members of "%{dzialka::%player%::name}%" parsed as region loop {_members::*}: if "%loop-value%" is "%{_p}%": execute console command "rg removemember -w %{dzialka::%player%::world}% %{dzialka::%player%::name}% %{_p}%" send "&c* &7Wyrzuciles %{_p}% z uzytkownikow swojej dzialki." stop send "&c* &7Ten gracz nie jest uzytkownikiem twojej dzialki." stop send "&c* &7Wpisz nick gracza, ktorego chcesz wyrzucic z swojej dzialki." stop if arg 1 is set: if arg 2 is not set: send "&c* &7Podaj nick kolegi." stop set {_p} to "%arg 2%" parsed as offlineplayer if {_p} is not online: send "&c* &7Tego gracza nie ma na serwerze." stop if {_p} is player: send "&c* &7Nie mozesz wpisac siebie." stop if arg 1 is "dodaj": set {_members::*} to members of "%{dzialka::%player%::name}%" parsed as region loop {_members::*}: if "%loop-value%" is "%{_p}%": send "&c* &7Ten gracz juz jest uzytkownikiem twojej dzialki." stop execute console command "rg addmember -w %{dzialka::%player%::world}% %{dzialka::%player%::name}% %{_p}%" send "&c* &7Dodales %{_p}% do swojej dzialki." stop if arg 1 is "przepisz": if {dzialka::%{_p}%} is not set: execute console command "rg removeowner -w %{dzialka::%player%::world}% %{dzialka::%player%::name}% %player%" execute console command "rg addowner -w %{dzialka::%player%::world}% %{dzialka::%player%::name}% %{_p}%" execute console command "rg addmember -w %{dzialka::%player%::world}% %{dzialka::%player%::name}% %player%" set {dzialka::%{_p}%} to {dzialka::%player%} set {dzialka::%{_p}%::name} to {dzialka::%player%::name} set {dzialka::%{_p}%::price} to {dzialka::%player%::price} set {dzialka::%{_p}%::world} to {dzialka::%player%::world} set line 3 of block at {dzialka::%player%} to "%{_p}%" clear {dzialka::%player%} clear {dzialka::%player%::name} clear {dzialka::%player%::price} clear {dzialka::%player%::world} send "&c* &7Pomyslnie przepisales dzialke na %{_p}%" send "&c* &7Gracz %player% przepisal tobie dzialke %{dzialka::%{_p}%::name}%" to {_p} stop send "&c* &7Gracz %{_p}% juz posiada dzialke." stop send "&c* &7Nie posiadasz dzialki." stop