Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function openGUI(r: Integer, n: String, p: Player):
- open chest with {_r} rows named "%{_n}%" to {_p}
- Function formatSlot(s: Integer, p: Player, a: Integer, i: Item, n: String, l: String, c: String):
- format slot {_s} of {_p} with {_a} of {_i} named "%{_n}%" with lore "%{_l}%" to run "%{_c}%"
- on script load:
- wait a tick
- if folder "plugins/Skript/scripts/EasyShops" isn't exists:
- send "&7[&6EasyShops] &7Pobieranie plikow konfiguracyjnych..." to console
- create file "plugins/Skript/scripts/EasyShops/config.yml"
- download "http://pastebin.com/raw.php?i=0C3VbyG5" to "plugins/Skript/scripts/EasyShops/config.yml"
- create file "plugins/Skript/scripts/EasyShops/buy.yml"
- download "http://pastebin.com/raw.php?i=a155g2p2" to "plugins/Skript/scripts/EasyShops/buy.yml"
- create file "plugins/Skript/scripts/EasyShops/sell.yml"
- download "http://pastebin.com/raw.php?i=uduCxrv2" to "plugins/Skript/scripts/EasyShops/sell.yml"
- send "&7[&6EasyShops] &7Zakonczono pobieranie plikow konfiguracyjnych." to console
- set {EasyShops::buy_command} to single value "options.buy_command" get of "plugins/Skript/scripts/EasyShops/config.yml"
- set {EasyShops::sell_command} to single value "options.sell_command" get of "plugins/Skript/scripts/EasyShops/config.yml"
- on command:
- if full command is "%{EasyShops::buy_command}%":
- cancel event
- set {_permission} to single value "options.buy_permission" get of "plugins/Skript/scripts/EasyShops/config.yml"
- if player has permission "%{_permission}%":
- set {_items::*} to configuration section "items" get of "plugins/Skript/scripts/EasyShops/buy.yml"
- set {_rows} to rounded up size of {_items::*}/9
- set {_name} to coloured single value "options.buy_name" get of "plugins/Skript/scripts/EasyShops/config.yml"
- openGUI({_rows}, "%{_name}%", player)
- loop {_items::*}:
- set {_slot} to loop-value parsed as integer-1
- set {_przedmiot} to single value "items.%loop-value%.przedmiot" get of "plugins/Skript/scripts/EasyShops/buy.yml" parsed as item
- set {_ilosc} to single value "items.%loop-value%.ilosc" get of "plugins/Skript/scripts/EasyShops/buy.yml" parsed as integer
- set {_cena} to single value "items.%loop-value%.cena" get of "plugins/Skript/scripts/EasyShops/buy.yml" parsed as integer
- formatSlot({_slot}, player, {_ilosc}, {_przedmiot}, "", "&6Cena: &c$%{_cena}%", "buyitem %player% %{_cena}% %{_ilosc}% %{_przedmiot}%")
- stop
- else:
- set {_no_permission_message} to coloured single value "options.buy_no_permission_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- send "%{_no_permission_message}%"
- stop
- if full command is "%{EasyShops::sell_command}%":
- cancel event
- set {_permission} to single value "options.sell_permission" get of "plugins/Skript/scripts/EasyShops/config.yml"
- if player has permission "%{_permission}%":
- set {_items::*} to configuration section "items" get of "plugins/Skript/scripts/EasyShops/sell.yml"
- set {_rows} to rounded up size of {_items::*}/9
- set {_name} to coloured single value "options.sell_name" get of "plugins/Skript/scripts/EasyShops/config.yml"
- openGUI({_rows}, "%{_name}%", player)
- loop {_items::*}:
- set {_slot} to loop-value parsed as integer-1
- set {_przedmiot} to single value "items.%loop-value%.przedmiot" get of "plugins/Skript/scripts/EasyShops/sell.yml" parsed as item
- set {_ilosc} to single value "items.%loop-value%.ilosc" get of "plugins/Skript/scripts/EasyShops/sell.yml" parsed as integer
- set {_cena} to single value "items.%loop-value%.cena" get of "plugins/Skript/scripts/EasyShops/sell.yml" parsed as integer
- formatSlot({_slot}, player, {_ilosc}, {_przedmiot}, "", "&6Cena: &c$%{_cena}%", "sellitem %player% %{_cena}% %{_ilosc}% %{_przedmiot}%")
- stop
- else:
- set {_no_permission_message} to coloured single value "options.sell_no_permission_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- send "%{_no_permission_message}%"
- stop
- command /buyitem [<player>] [<integer>] [<integer>] [<item>]:
- trigger:
- if sender is console:
- if player-arg's money is more than or equal to integer-arg 1:
- if player-arg can hold integer-arg 2 of item-arg:
- set {_buy_message} to coloured single value "options.buy_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- replace all "{ILOSC}" with "%integer-arg 2%" in {_buy_message}
- replace all "{PRZEDMIOT}" with "%item-arg%" in {_buy_message}
- replace all "{CENA}" with "%integer-arg 1%" in {_buy_message}
- replace all "{PIENIADZE}" with "%player-arg's money%" in {_buy_message}
- remove integer-arg 1 from player-arg's money
- add integer-arg 2 of item-arg to player-arg
- send "%{_buy_message}%" to player-arg
- stop
- else:
- set {_buy_no_space_message} to coloured single value "options.buy_no_space_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- send "%{_buy_no_space_message}%" to player-arg
- stop
- else:
- set {_buy_no_money_message} to coloured single value "options.buy_no_money_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- replace all "{CENA}" with "%integer-arg 1%" in {_buy_no_money_message}
- replace all "{PIENIADZE}" with "%player-arg's money%" in {_buy_no_money_message}
- replace all "{BRAKUJE}" with "%integer-arg 1-player-arg's money%" in {_buy_no_money_message}
- send "%{_buy_no_money_message}%" to player-arg
- stop
- else:
- send "Unknown command. Type ""/help"" for help." to player
- stop
- command /sellitem [<player>] [<integer>] [<integer>] [<item>]:
- trigger:
- if sender is console:
- if player-arg has integer-arg 2 of item-arg:
- set {_sell_message} to coloured single value "options.sell_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- replace all "{ILOSC}" with "%integer-arg 2%" in {_sell_message}
- replace all "{PRZEDMIOT}" with "%item-arg%" in {_sell_message}
- replace all "{CENA}" with "%integer-arg 1%" in {_sell_message}
- replace all "{PIENIADZE}" with "%player-arg's money%" in {_sell_message}
- add integer-arg 1 to player-arg's money
- remove integer-arg 2 of item-arg from player-arg
- send "%{_sell_message}%" to player-arg
- stop
- else:
- set {sell_no_items_message} to coloured single value "options.sell_no_items_message" get of "plugins/Skript/scripts/EasyShops/config.yml"
- replace all "{ILOSC}" with "%integer-arg 2%" in {sell_no_items_message}
- replace all "{PRZEDMIOT}" with "%item-arg%" in {sell_no_items_message}
- send "%{sell_no_items_message}%" to player-arg
- stop
- else:
- send "Unknown command. Type ""/help"" for help." to player
- stop
Advertisement
Add Comment
Please, Sign In to add comment