Set usage limit on minecraft command block?



  • I'm trying to use command blocks in minecraft so that 'new players' can get a starter kit by clicking a button.

    The problem is, I don't want this to be abused and I only want the command to be triggered if the user has never clicked the button themselves.

    Is there a mechanism to do this? And if so, how? (Note I'm new to command blocks, but not to Minecraft in general)



  • Thanks to bco2135 in comments for starting to steer me in the right direction. Thanks to their suggestion to leverage scoreboard and customized objective tracking that way, this has allowed me to get limited execution on items in a single command block properly. There's follow-up for me to do here in additional questions, but at least the first part is handled here.

    Effectively, I have to do the following (assumes: cheats and op mode):

    1. Add a dummy objective I want to track

      /scoreboard objective add Tracker dummy Tracker
      
    2. Use an always active command block to add 0 to all players (effective on join) for this objective

      /scoreboard players add @a Tracker 0
      
    3. Use an execute if entity conditional in the command block able to be triggered by a button:

      /execute if entity @p[scores={Tracker=0}] run ...
      

      ... specifying of course the command to execute when this is true.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2