Browse Source

龙猫快用execute store result 统计玩家数量

00ll00 6 years ago
parent
commit
e993e937ae
1 changed files with 1 additions and 2 deletions
  1. 1 2
      data/ltw/functions/state/0/start_gameparty.mcfunction

+ 1 - 2
data/ltw/functions/state/0/start_gameparty.mcfunction

@@ -1,8 +1,7 @@
 # 尝试开始小游戏模式
 
 # 计算玩家数量
-scoreboard players set $count mem 0
-execute as @a[tag=hub_gameparty] run scoreboard players add $count mem 1
+execute store result score $count mem if entity @a[tag=hub_gameparty]
 
 # 根据玩家数量判定
 execute if score $count mem matches ..2 run tellraw @a[tag=hub_gameparty] [{"text": "人数不足, 需要至少 3 人, 当前仅有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]