欢迎光临散文网 会员登陆 & 注册

[MCBE]1CB可自定义商店系统

2023-08-06 09:13 作者:Minecraft-ywz  | 我要投稿

指令楼:

创建积分版:

/scoreboard objectives add 数据 dummy

/scoreboard objectives add 数量 dummy

/scoreboard objectives add 购买 dummy

/scoreboard objectives add 金币 dummy

/scoreboard objectives add cd dummy

创建虚拟计分项:

/scoreboard players set 十 数据 10

视角检测:

execute @a[ry=30,rym=0,rx=-20,tag=u] ~~~ scoreboard players set @s cd 1

execute @a[ry=60,rym=30,rx=-20,tag=u] ~~~ scoreboard players set @s cd 2

execute @a[ry=90,rym=60,rx=-20,tag=u] ~~~ scoreboard players set @s cd 3

execute @a[ry=30,rym=0,rx=-5,rxm=-10,tag=u] ~~~ scoreboard players set @s cd 4

execute @a[ry=60,rym=30,rx=-5,rxm=-10,tag=u] ~~~ scoreboard players set @s cd 5

execute @a[ry=90,rym=60,rx=-5,rxm=-10,tag=u] ~~~ scoreboard players set @s cd 6

execute @a[ry=30,rym=0,rx=10,rxm=0,tag=u] ~~~ scoreboard players set @s cd 7

execute @a[ry=60,rym=30,rx=10,rxm=0,tag=u] ~~~ scoreboard players set @s cd 8

execute @a[ry=90,rym=60,rx=10,rxm=0,tag=u] ~~~ scoreboard players set @s cd 9

execute @a[ry=30,rym=0,rx=20,rxm=10,tag=u] ~~~ scoreboard players set @s cd 10

execute @a[ry=60,rym=30,rx=20,rxm=10,tag=u] ~~~ scoreboard players set @s cd 11

execute @a[ry=90,rym=60,rx=20,rxm=10,tag=u] ~~~ scoreboard players set @s cd 12

scoreboard players add @a 数据 0

scoreboard players add @a 购买 0

scoreboard players set @a[tag=!u,scores={数据=!0,购买=0}] 数据 0

玩家购买检测:

testfor @a[scores={购买=1..},tag=!u]

setblock ~1 ~ ~ chain_command_block 5(上面这个是有条件连锁保持开启)

空一格

setblock ~-1 ~ ~ air

execute @a[tag=!u,scores={购买=1..}] ~ ~ ~ detect ~ ~-1 ~ quartz_block 0 execute @s ~ ~ ~ detect ~ ~-2 ~ command_block -1 execute @s ~ ~ ~ detect ~ ~-3 ~ barrel -1 tellraw @s {"rawtext":[{"text":"§a》》§7物品信息对接成功"}]}

execute @a[tag=!u,scores={购买=1..}] ~ ~ ~ detect ~ ~-1 ~ quartz_block 0 execute @s ~ ~ ~ detect ~ ~-2 ~ command_block -1 execute @s ~ ~ ~ detect ~ ~-3 ~ barrel -1 playsound random.enderchestopen @s ~~~ 1 1.38

execute @a[tag=!u,scores={购买=1..}] ~ ~ ~ detect ~ ~-1 ~ quartz_block 0 execute @s ~ ~ ~ detect ~ ~-2 ~ command_block -1 execute @s ~ ~ ~ detect ~ ~-3 ~ barrel -1 tp @s ~~~ 45 -10

execute @a[tag=!u,scores={购买=1..}] ~ ~ ~ detect ~ ~-1 ~ quartz_block 0 execute @s ~ ~ ~ detect ~ ~-2 ~ command_block -1 execute @s ~ ~ ~ detect ~ ~-3 ~ barrel -1 tag @s add u

tellraw @a[tag=!u,scores={购买=1..}] {"rawtext":[{"text":"§4》》§7请站在石英块上"}]}

scoreboard players set @a[tag=!u,scores={购买=1..}] 购买 0

显示:

execute @a[scores={cd=1},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

§6[§g1§6]§7 [2] [3]

[4] [5] [6]

[7] [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=2},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] §6[§g2§6]§7 [3]

[4] [5] [6]

[7] [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=3},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] §6[§g3§6]§7

[4] [5] [6]

[7] [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=4},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

§6[§g4§6]§7 [5] [6]

[7] [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=5},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] §6[§g5§6]§7 [6]

[7] [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=6},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] §6[§g6§6]§7

[7] [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=7},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] [6]

§6[§g7§6]§7 [8] [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=8},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] [6]

[7] §6[§g8§6]§7 [9]

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=9},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] [6]

[7] [8] §6[§g9§6]§7

[清除] [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=10},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] [6]

[7] [8] [9]

§6[§g清除§6]§7 [0] [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=11},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] [6]

[7] [8] [9]

[清除] §6[§g0§6]§7 [确认]

§r§c[§4Shop§c]§r--------------□"}]}

execute @a[scores={cd=12},tag=u] ~~~ titleraw @s actionbar {"rawtext":[

{"text":"§b -§7Purchase menu§b-

§5-§7购买菜单§5-

§2۞§a购买数量:§6"},

{"score":{"name":"@s","objective":"数据"}},

{"text":"

§r□------------------□§l§7

[1] [2] [3]

[4] [5] [6]

[7] [8] [9]

[清除] [0] §6[§g确认§6]

§r§c[§4Shop§c]§r--------------□"}]}

检测购买玩家是否在商品位置:

execute @a[tag=u,scores={购买=1..}] ~ ~ ~ tag @s add 检测

execute @a[tag=u,scores={购买=1..}] ~ ~ ~ detect ~ ~-1 ~ quartz_block 0 execute @s ~ ~ ~ detect ~ ~-2 ~ command_block -1 execute @s ~ ~ ~ detect ~ ~-3 ~ barrel -1 tag @s remove 检测

execute @a[tag=u,scores={购买=1..}] ~ ~ ~ detect ~~-1~ wooden_button -1 execute @s ~~~ detect ~ ~-2 ~ quartz_block 0 execute @s ~ ~ ~ detect ~ ~-3 ~ command_block -1 execute @s ~ ~ ~ detect ~ ~-4 ~ barrel -1 tag @s remove 检测

execute @a[tag=检测,tag=u,scores={购买=1..}] ~ ~ ~ tellraw @s {"rawtext":[{"text":"§4》》§7物品信息对接错误,已重置"}]}

scoreboard players set @a[tag=检测] 购买 0

tag @a[tag=检测] remove u

tag @a remove 检测

一些计算:

execute @a[tag=u,scores={购买=1..,cd=1..11,cd=!10}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 数据 *= 十 数据

execute @a[tag=u,scores={购买=1..,cd=1..9}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 数据 += @s cd

execute @a[tag=u,scores={购买=1..,cd=10}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 数据 /= 十 数据

execute @a[tag=u,scores={购买=1..,cd=12}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 购买 *= @s 数据

execute @a[scores={购买=1..,cd=12}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 金币 -= @s 购买

execute @a[tag=u,scores={购买=1..,cd=12,金币=..-1}] ~~~ detect ~~-1~ wooden_button -1 playsound block.false_permissions @s ~~~ 0.8 2

tellraw @a[scores={金币=..-1},tag=u] {"rawtext":[{"text":"§4》》§7购买失败,金币不足"}]}

execute @a[tag=u,scores={购买=1..,cd=12,金币=..-1}] ~~~ detect ~~-1~ wooden_button -1 playsound random.glass @s ~ ~ ~ 0.7 1.8

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 clone ~~-4~ ~~-4~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 setblock ~~~ air 0 destroy

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 kill @e[type=item,c=1,r=1.5,name=木桶]

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop1 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop1 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop2 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop2 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop4 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop4 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop8 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop8 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop16 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop16 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop32 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop32 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 structure save shop64 ~~~ ~~~

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 kill @e[r=1,type=item]

execute @a[scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 数量 = @s 数据

execute @a[scores={购买=1..,cd=12,金币=0..,数据=64..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop64 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=64..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 64

execute @a[scores={购买=1..,cd=12,金币=0..,数据=32..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop32 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=32..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 32

execute @a[scores={购买=1..,cd=12,金币=0..,数据=16..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop16 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=16..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 16

execute @a[scores={购买=1..,cd=12,金币=0..,数据=8..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop8 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=8..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 8

execute @a[scores={购买=1..,cd=12,金币=0..,数据=4..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop4 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=4..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 4

execute @a[scores={购买=1..,cd=12,金币=0..,数据=2..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop2 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=2..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 2

execute @a[scores={购买=1..,cd=12,金币=0..,数据=1..}] ~~~ detect ~~-1~ wooden_button -1 structure load shop1 ~~~

execute @a[scores={购买=1..,cd=12,金币=0..,数据=1..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players remove @s 数据 1

execute @a[tag=u,scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 数据 = @s 数量

execute @a[tag=u,scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 tellraw @s {"rawtext":[{"text":"§a》》§7购买成功,共花费§b"},

{"score":{"name":"@s","objective":"购买"}},

{"text":"元§g购买了§6"},{"score":{"name":"@s","objective":"数据"}},{"text":"§g件§l§e"},{"selector":"@e[c=1,type=item,r=1.5]"}]}

execute @a[tag=u,scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 playsound random.orb @s ~ ~ ~ 1 0.32

execute @a[tag=u,scores={购买=1..,cd=12,金币=0..}] ~~~ detect ~~-1~ wooden_button -1 playsound random.chestopen @s ~~~ 0.75 0.85

execute @a[scores={购买=1..,cd=12,金币=..-1}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players operation @s 金币 += @s 购买

execute @a[tag=u,scores={购买=1..,cd=12}] ~~~ detect ~~-1~ wooden_button -1 tag @s remove u

execute @a[scores={购买=1..,cd=12}] ~~~ detect ~~-1~ wooden_button -1 scoreboard players set @s 购买 0

execute @a[tag=u,scores={购买=1..,cd=1..}] ~~~ detect ~~-1~ wooden_button -1 tp @s ~~-1~

没有了.....

[MCBE]1CB可自定义商店系统的评论 (共 条)

分享到微博请遵守国家法律