try_start_gameparty.mcfunction 803 B

12345678910111213
  1. # 尝试开始小游戏模式
  2. # 计算玩家数量
  3. execute store result score $count mem if entity @a[tag=hub_gameparty]
  4. # 根据玩家数量判定
  5. execute if score $count mem matches ..1 as @a at @s run function lib:sounds/error
  6. execute if score $count mem matches ..1 run tellraw @a [{"text": "需要至少 2 人以开始小游戏模式, 当前仅有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
  7. execute if score $count mem matches 9.. as @a at @s run function lib:sounds/error
  8. execute if score $count mem matches 9.. run tellraw @a [{"text": "小游戏模式最多支持 8 人, 当前已有 ","color":"red"},{"score": { "name": "$count","objective": "mem"}}, " 人!"]
  9. # 判断旁观
  10. execute if score $count mem matches 2..8 run function ltw:state/0/start_gameparty