#Skrypt stworzony przez Knugi dla MineRp » « #@Skript2.2+ #Dodatki: # @Skript-mirror-v0.9 # @SkQueryLime-3.6.x options: CenaZaZeton: 2 NpcNameOblsuga: Obsluga GuiNameObsluga: &7Obsluga GuiNameBuyTalon: &2Kup Zetony GuiNameSellTalon: &cSprzedaj Zetony on script load: import "org.bukkit.event.player.PlayerInteractEntityEvent" import "org.bukkit.event.inventory.InventoryClickEvent" function KASYNO_getInventory(f: string, p: player) :: inventory: if {_f} is "buy": set {_n} to "{@GuiNameBuyTalon}" set {_prefix} to "&2Kup" else: set {_n} to "{@GuiNameSellTalon}" set {_prefix} to "&cSprzedaj" set {_x} to chest with 3 rows named "%coloured {_n}%" loop 27 times: set slot ((loop-number)-1) of {_x} to gray glass named "&7" set slot 11 of {_x} to sunflower named "%{_prefix}% &750 zetonow" set slot 13 of {_x} to sunflower named "%{_prefix}% &7100 zetonow" set slot 15 of {_x} to sunflower named "%{_prefix}% &7500 zetonow" return {_x} on "org.bukkit.event.player.PlayerInteractEntityEvent": set {_entity} to event.getRightClicked() if name of {_entity} is "{@NpcNameOblsuga}": set {_p} to event.getPlayer() set {_x} to chest with 1 row named "{@GuiNameObsluga}" loop 9 times: set slot ((loop-number) - 1) of {_x} to gray glass named "&7" set slot 3 of {_x} to ("35:5" parsed as item type) named "&2Kup zetony" set slot 5 of {_x} to ("35:14" parsed as item type) named "&cSprzedaj zetony" open {_x} to {_p} on "org.bukkit.event.inventory.InventoryClickEvent": set {_top} to event.getWhoClicked().getOpenInventory().getTopInventory() set {_p} to event.getWhoClicked() if inventory name of {_top} is "{@GuiNameObsluga}": cancel event if event.getClickedInventory() is {_top}: if event.getRawSlot() is 3: close {_p}'s inventory wait 2 tick open KASYNO_getInventory("buy", {_p}) to {_p} stop if event.getRawSlot() is 5: close {_p}'s inventory wait 2 tick open KASYNO_getInventory("sell", {_p}) to {_p} stop stop if inventory name of {_top} is "{@GuiNameBuyTalon}": cancel event if event.getClickedInventory() is {_top}: if event.getRawSlot() is 11: if {_p}'s balance is larger than or equal to 50*{@CenaZaZeton}: add 50 to {kasyno::balance::%{_p}%} remove 50*{@CenaZaZeton} from {_p}'s balance send "&7Zakupiles &c50 zetonow&7." to {_p} stop send "&7Nie posiadasz &c%50*{@CenaZaZeton}%$&7." to {_p} stop if event.getRawSlot() is 13: if {_p}'s balance is larger than or equal to 100*{@CenaZaZeton}: add 100 to {kasyno::balance::%{_p}%} remove 100*{@CenaZaZeton} from {_p}'s balance send "&7Zakupiles &c100 zetonow&7." to {_p} stop send "&7Nie posiadasz &c%100*{@CenaZaZeton}%$&7." to {_p} stop if event.getRawSlot() is 15: if {_p}'s balance is larger than or equal to 500*{@CenaZaZeton}: add 500 to {kasyno::balance::%{_p}%} remove 500*{@CenaZaZeton} from {_p}'s balance send "&7Zakupiles &c500 zetonow&7." to {_p} stop send "&7Nie posiadasz &c%500*{@CenaZaZeton}%$&7." to {_p} stop if inventory name of {_top} is "{@GuiNameSellTalon}": cancel event if event.getClickedInventory() is {_top}: if event.getRawSlot() is 11: if {kasyno::balance::%{_p}%} is larger than or equal to 50: add 50*{@CenaZaZeton} to {_p}'s balance remove 50 from {kasyno::balance::%{_p}%} send "&7Sprzedales &c50 zetonow&7." to {_p} stop send "&7Nie posiadasz &c50 zetonow&7." to {_p} stop if event.getRawSlot() is 13: if {kasyno::balance::%{_p}%} is larger than or equal to 100: add 100*{@CenaZaZeton} to {_p}'s balance remove 100 from {kasyno::balance::%{_p}%} send "&7Sprzedales &c100 zetonow&7." to {_p} stop send "&7Nie posiadasz &c100 zetonow$&7." to {_p} stop if event.getRawSlot() is 15: if {kasyno::balance::%{_p}%} is larger than or equal to 500: add 500 to {_p}'s balance remove 500 from {kasyno::balance::%{_p}%} send "&7Sprzedales &c500 zetonow&7." to {_p} stop send "&7Nie posiadasz &c500 zetonow$&7." to {_p} stop command /zetony []: trigger: set {_x} to "&7Posiadasz: &c%{kasyno::balance::%player%}% zetonow&7." replace all "" with "0" in {_x} send {_x}