Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on right click on villager:
- clicked entity has the scoreboard tag "shop"
- set {_n} to clicked entity's name
- cancel event
- if player is sneaking:
- player has permission "skript.admin"
- wait a tick
- open chest with 5 row named "&8ShopEdit %{_n}%" to player
- loop 36 times:
- set slot loop-number - 1 of player's current inventory to {shopitem.%{_n}%.%loop-number - 1%}
- loop 8 times:
- set slot loop-number + 35 of player's current inventory to gray stained glass pane with name "§f"
- set slot 44 of player's current inventory to barrier with name "§cshopを削除"
- stop
- open chest with 6 row named "%{_n}%&8's Shop" to player
- loop 9 times:
- set slot loop-number - 1 of player's current inventory to {shopitem.%{_n}%.%loop-number - 1%}
- set slot loop-number + 8 of player's current inventory to flower pot with name "§f⇃必要アイテム⇂"
- set slot loop-number + 44 of player's current inventory to gray stained glass pane with name "§f"
- loop 27 times:
- set slot loop-number + 17 of player's current inventory to {shopitem.%{_n}%.%loop-number + 8%}
- on inventory click:
- set {_n} to name of player's current inventory
- replace "&8's Shop" with "" in {_n}
- if {shoplist::%{_n}%} is set:
- cancel event
- clicked inventory is player's current inventory
- clicked slot is 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8
- set {_b1} to amount of item slot clicked slot + 18 of player's current inventory - 1
- set {_b2} to amount of item slot clicked slot + 27 of player's current inventory - 1
- set {_b3} to amount of item slot clicked slot + 36 of player's current inventory - 1
- if amount of {shopitem.%{_n}%.%clicked slot + 9%} in player's inventory > {_b1}:
- amount of {shopitem.%{_n}%.%clicked slot + 18%} in player's inventory > {_b2}
- amount of {shopitem.%{_n}%.%clicked slot + 27%} in player's inventory > {_b3}
- set {_b} to true
- if {_b} is true:
- give clicked item to player
- remove {shopitem.%{_n}%.%clicked slot + 9%} from player
- remove {shopitem.%{_n}%.%clicked slot + 18%} from player
- remove {shopitem.%{_n}%.%clicked slot + 27%} from player
- set {_cn} to clicked item's name
- if {_cn} is not set:
- message "&7%clicked item%を購入しました"
- else:
- message "&7%{_cn}%を購入しました"
- else:
- message "&7取引に必要なアイテムが足りません" to player
- stop
- replace "&8ShopEdit " with "" in {_n}
- if {shoplist::%{_n}%} is set:
- if clicked slot is 36 or 37 or 38 or 39 or 40 or 41 or 42 or 43 or 44:
- cancel event
- if clicked slot is 44:
- execute player command "/shop-delete %{_n}%"
- close player's inventory
- on inventory close:
- set {_n} to name of player's current inventory
- replace "&8ShopEdit " with "" in {_n}
- {shoplist::%{_n}%} is set
- loop 36 times:
- set {_l} to loop-number - 1
- set {shopitem.%{_n}%.%{_l}%} to slot {_l} of player's current inventory
- command /shop-list:
- permission: skript.admin
- trigger:
- loop {shoplist::*}:
- message "%loop-index% : %loop-value%" to player
- command /shop-create <text>:
- permission: skript.admin
- trigger:
- if {shoplist::%arg%} is set:
- message "その名前のshopは既に作成されています"
- stop
- execute player command "summon villager ~ ~ ~ {CustomName:""%arg%"",CustomNameVisible:1,Tags:[""shop""],Profession:0,Invulnerable:1,NoAI:1,Silent:1}"
- set {shoplist::%arg%} to player's location
- message "shopを作成しました" to player
- command /shop-delete <text>:
- permission: skript.admin
- trigger:
- if {shoplist::%arg%} is set:
- delete {shoplist::%arg%}
- loop 36 times:
- delete {shopitem.%arg%.%loop-number - 1%}
- execute console command "kill @e[tag=shop,name=%arg%]"
- message "%arg%'s Shop を削除しました。" to player
- else:
- message "%arg% は存在しません。" to player
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement