#AxShop - Zaawanowany skrypt na Sklep pełna konfiguracja #$ Wersja 1.0 $# on join: if {AxShop::player::%player%} is not set: set {AxShop::player::%player%} to 0 function AxShopConfig(t: text=""): create folder "plugins/Skript/scripts/AxShop" loop ("Buy" and "Sell" and "Config"): if yaml value "Config" from file "AxShop/%loop-value%.yml" is not true: send "&4[AxShop] &cNie wykryto ustawien! &4(%loop-value%)" to console send "&4[AxShop] &cTworzenie pliku... &4(%loop-value%)" to console create folder "plugins/Skript/scripts/AxShop" wait 2 tick create file "plugins/Skript/scripts/AxShop/%loop-value%.yml" wait 5 tick send "&4[AxShop] &cPobieranie przykladowych ustawien... &4(%loop-value%)" to console if loop-value is "Config": download "https://pastebin.com/raw/RXsQ0z19" to file "plugins/Skript/scripts/AxShop/Config.yml" if loop-value is "Buy": download "https://pastebin.com/raw/S8UP3uwR" to file "plugins/Skript/scripts/AxShop/Buy.yml" if loop-value is "Sell": download "https://pastebin.com/raw/zGkQba6y" to file "plugins/Skript/scripts/AxShop/Sell.yml" send "&4[AxShop] &cPobrano przykladowe ustawienia! &4(%loop-value%)" to console function AxShopLoad(t: text=""): Broadcast "&a[AxShop] &eLadowanie sklepu..." loop ("Sell" and "Buy"): set {_%loop-value%::*} to yaml nodes "Items" from file "AxShop/%loop-value%.yml" send "&a[AxShop] &eUsunieto config &b%loop-value-1%&e..." to console clear {AxShop::config::items::%loop-value%::*} loop {_%loop-value%::*}: loop ("Execute-Console" and "Execute-Player" and "Item.Item" and "Item.Name", "Item.Lore", "Gui.Name", "Gui.Lore", "Gui.Item", "Message", "Price-Message", "Price"): set {AxShop::config::items::%loop-value-1%::%loop-value-2%.%loop-value-3%} to yaml value "Items.%loop-value-2%.%loop-value-3%" from file "AxShop/%loop-value-1%.yml" add 1 to {_G} if {AxShop::config::items::%loop-value-1%::%loop-value-2%.%loop-value-3%} is not set: delete {AxShop::config::items::%loop-value-1%::%loop-value-2%.%loop-value-3%} remove 1 from {_G} send "&a[AxShop] &eWczytano nowy config &b%loop-value-1% &c(%size of {_%loop-value%::*}% itemow) &9(%{_G}% zmiennych)" to console send "&a[AxShop] &eLadowanie &aconfig.yml!&e..." to console loop ("Gui.Sell.Back.Slot" and "Gui.Buy.Back.Slot" and "Gui.Sell.Back.Name" and "Gui.Sell.Back.Lore" and "Gui.Sell.Back.Item" and "Gui.Buy.Back.Name" and "Gui.Buy.Back.Lore" and "Gui.Buy.Back.Item" and "SellAll-Message" and "Default-Price-Message.Buy" and "Default-Price-Message.Sell" and "Default-Message.Buy" and "Default-Message.Sell" and "Gui.Main.Name" and "Gui.Main.Size", "Gui.Sell.Size", "Gui.Buy.Size", "Gui.Sell.Name", "Gui.Buy.Name", "Gui.Main.BackGround.Name", "Gui.Main.BackGround.Item", "Gui.Main.BackGround.Lore", "Gui.Main.Coin.Item", "Gui.Main.Coin.Slot", "Gui.Main.Coin.Name", "Gui.Main.Coin.Lore", "Gui.Main.Buy.Item", "Gui.Main.Buy.Slot", "Gui.Main.Buy.Name", "Gui.Main.Buy.Lore", "Gui.Main.Sell.Item", "Gui.Main.Sell.Slot", "Gui.Main.Sell.Name", "Gui.Main.Sell.Lore"): set {AxShop::config::config::%loop-value%} to yaml value "%loop-value%" from file "AxShop/Config.yml" add 1 to {_Z} if {AxShop::config::config::%loop-value%} is not set: delete {AxShop::config::config::%loop-value%} remove 1 from {_Z} send "&a[AxShop] &eZaladowano &aconfig.yml! &9(%{_Z}% zmiennych)" to console send "&a[AxShop] &eZaladowano &a%size of {AxShop::player::*}% &eUzytkownikow" to console Broadcast "&a[AxShop] &eZaladowano sklep!" send "&c[AxShop] &cJezeli przykładowe opcje sie nie pobrały pobierz je ręcznie: http://www.mediafire.com/file/336qnwm43uww3ar/AxShop.rar/file" to console function AxShopReturnItem(p: player, t: text) :: itemtype: set {_i} to {AxShop::config::%{_t}%.Item} parsed as item set {_price} to {_t} replace all ".Gui" and ".Item" with "" in {_price} if {AxShop::config::%{_t}%.Name} is set: set name of {_i} to colored {AxShop::config::%{_t}%.Name} replace all "{COIN}" with "%{AxShop::player::%{_p}%}%" in Name of {_i} replace all "{PRICE}" with "%{AxShop::config::%{_price}%.Price}%" in Name of {_i} replace all "{PLAYER}" with "%name of {_p}%" in Name of {_i} if {AxShop::config::%{_t}%.Lore} is set: set lore of {_i} to colored {AxShop::config::%{_t}%.Lore} replace all "{COIN}" with "%{AxShop::player::%{_p}%}%" in Lore of {_i} replace all "{PRICE}" with "%{AxShop::config::%{_price}%.Price}%" in Lore of {_i} replace all "{PLAYER}" with "%name of {_p}%" in Lore of {_i} return {_i} function Message(p: player, t: text, s: text="X", b: boolean=true): if {_b} is true: set {_m} to {AxShop::config::items::%{_s}%::%{_t}%.Message} if {_m} is not set: set {_m} to {AxShop::config::config::Default-Message.%{_s}%} if {_m} is set: replace all "{PLAYER}" with name of {_p} in {_m} replace all "{PRICE}" with {AxShop::config::items::%{_s}%::%{_t}%.Price} in {_m} replace all "{ITEM}" with {_t} in {_m} replace all "{COIN}" with "%{AxShop::player::%{_p}%}%" in {_m} send "%colored {_m}%" to {_p} else: set {_m} to {AxShop::config::items::%{_s}%::%{_t}%.Price-Message} if {_m} is not set: set {_m} to {AxShop::config::config::Default-Price-Message.%{_s}%} if {_m} is set: replace all "{PLAYER}" with name of {_p} in {_m} replace all "{PRICE}" with {AxShop::config::items::%{_s}%::%{_t}%.Price} in {_m} replace all "{ITEM}" with {_t} in {_m} replace all "{COIN}" with "%{AxShop::player::%{_p}%}%" in {_m} send "%colored {_m}%" to {_p} command /sklep []: trigger: if arg 1 is "reload": AxShopConfig() AxShopLoad() open chest with {AxShop::config::config::Gui.Main.Size} rows named colored {AxShop::config::config::Gui.Main.Name} to player loop {AxShop::config::config::Gui.Main.Size}*9 times: set player's current inventory's slot ((loop-number)-1) to AxShopReturnItem(player, "config::Gui.Main.BackGround") loop ("Coin" and "Buy" and "Sell"): set player's current inventory's slot {AxShop::config::config::Gui.Main.%loop-value%.Slot} to AxShopReturnItem(player, "config::Gui.Main.%loop-value%") stop on inventory click: if inventory name of current inventory of player is colored {AxShop::config::config::Gui.Main.Name}: cancel event loop ("Buy" and "Sell"): if clicked slot is {AxShop::config::config::Gui.Main.%loop-value%.Slot}: close player's inventory set {_list::*} to yaml nodes "Items" from file "AxShop/%loop-value%.yml" if {AxShop::config::config::Gui.%loop-value%.Size} is -1: set {AxShop::config::config::Gui.%loop-value%.Size} to (rounded up ((size of {_list::*})/9)) open chest with {AxShop::config::config::Gui.%loop-value%.Size} rows named colored {AxShop::config::config::Gui.%loop-value%.Name} to player set player's current inventory's slot {AxShop::config::config::Gui.%loop-value%.Back.Slot} to AxShopReturnItem(player, "config::Gui.%loop-value%.Back") loop {_list::*}: set player's current inventory's slot ((loop-index parsed as integer)-1) to AxShopReturnItem(player, "items::%loop-value-1%::%loop-value-2%.Gui") stop loop ("Sell" and "Buy"): if inventory name of current inventory of player is colored {AxShop::config::config::Gui.%loop-value%.Name}: cancel event if player's current inventory's slot slot is AxShopReturnItem(player, "config::Gui.%loop-value%.Back"): close player's inventory execute player command "sklep" else: set {_list::*} to yaml nodes "Items" from file "AxShop/%loop-value%.yml" if loop-value is "Buy": if {AxShop::player::%player%} >= {AxShop::config::items::Buy::%{_list::%(clicked slot)+1%}%.Price}: add AxShopReturnItem(player, "items::Buy::%{_list::%(clicked slot)+1%}%.Item") to player remove {AxShop::config::items::Buy::%{_list::%(clicked slot)+1%}%.Price} from {AxShop::player::%player%} if {AxShop::config::items::Buy::%{_list::%(clicked slot)+1%}%.Execute-Console} is set: set {_m} to {AxShop::config::items::Buy::%{_list::%(clicked slot)+1%}%.Execute-Console} replace all "{PLAYER}" with name of player in {_m} replace all "{PRICE}" with "%{AxShop::config::items::Buy::%{_list::%(clicked slot)+1%}%.Price}%" in {_m} replace all "{ITEM}" with "%{_list::%(clicked slot)+1%}%" in {_m} replace all "{COIN}" with "%{AxShop::player::%player%}%" in {_m} execute console command "%{_m}%" Message(player, {_list::%(clicked slot)+1%}, "Buy", true) else: Message(player, {_list::%(clicked slot)+1%}, "Buy", false) else: if player has AxShopReturnItem(player, "items::Sell::%{_list::%(clicked slot)+1%}%.Item"): remove AxShopReturnItem(player, "items::Sell::%{_list::%(clicked slot)+1%}%.Item") from player add {AxShop::config::items::Sell::%{_list::%(clicked slot)+1%}%.Price} to {AxShop::player::%player%} Message(player, {_list::%(clicked slot)+1%}, "Sell", true) else: Message(player, {_list::%(clicked slot)+1%}, "Sell", false)