I am building a gambling machine that uses command blocks to take money from, and give money to a player. It also sends game messages to the player via the command blocks. Therefore, I want only one player in the gambling machine area at a time.

Is there some way to read a flag at a distant location that might indicate a person is there (because they are standing on a pressure plate)? I tried using pressure plates the player stands on, but when the player leaves, the redstone circuit "freezes" so it thinks a player is still gambling. Is there a way I could communicate the information wirelessly?


2 Answers 2


By having a simple system to allow a user to enter the gambling zone, like a command block teleporting them, you can then use an RS-NOR latch to remember if a player is inside the gambling zone or not. You can then use an AND gate connected to the RS-NOR and to a button, which then connects to the command block to teleport the user into the gambling zone. It would also change the RS-NOR latch to the on state. Inside the gambling zone, you can have a button to leave, which would connect to a command block to teleport the player, and also to the reset line of the RS-NOR.

Here is a (hopefully) simple diagram demonstrating what you can do. The two command blocks (Com. Block Out & Com. Block In) would contain the teleport command (/tp @p x y z) to go out of the gambling zone, and into the gambling zone, respectively.

Simple One-Person-at-a-time Circuit

This circuit will make sure that only one person can go in at the one time, and they can also not allow other people to enter.

As pointed out in the comments, this system will not be able to check for if a player leaves while they are inside the gambling zone. However, by adding the simple circuit in the diagram below, possibly to a location underneath the gambling zone (so you can use the r argument to check for players), you can fix this issue. Basically the below circuit will find if there are no players inside the gambling zone, and if so, will output a signal that connects to the RS-NOR latch on the above diagram...

Simple Checker Circuit

The command block Com. Block Check would contain a testfor command (/testfor @a[r=5] for example).

  • The fact that @p might select the wrong player is not really a problem, it still makes sure that only one player at a time can ever get inside, so that the gambling - or whatever - will only be dealing with one person at a time.
    – fredley
    Commented Apr 15, 2013 at 10:10
  • You still need three more command blocks on a clock: two to test if more than one person is in the area, and if so, teleport them out, and another to reset the RS-NOR latch if the area's already empty.
    – MBraedley
    Commented Apr 15, 2013 at 10:49
  • How would this setup work if a player drops while in the gambling machine? I suspect it would leave the gambling machine stuck in the "occupied" state, and no one would be able to use it until it was manually reset. While close, it does not solve the entire problem.
    – rmarenda
    Commented Apr 15, 2013 at 11:18

There are many ways to do this, and it all depends on how complex you are willing to go. The first one would be to make it so that a player has to flip a lever once they're inside to make the machine operable, but would also close an iron door (or a piston door).

A possible example of this could be when they go inside, there are two iron doors, explained in this diagram below. The first one is open, the second is closed, so to progress on they have to flip a lever to open the second door, but that lever will close the first door, preventing others from coming in. (It's not fool-proof, multiple people can enter at the same time, to mess up the system, but it's pretty secure if the player goes in alone, and does not try to let others in.


The second way would be to make some scripts using variable triggers, provided you're doing this on a bukkit server- this get's more advanced and I can't help you much, but when it works it will be awesome! Get Variable Triggers - Bukkit Plugin

  • The first two examples, while functional locally, are not functional over longer distances. The gambling machines are fairly large, and are separated by lots of room, to make expansion and upgrades possible. I am curious about this scripting solution. I am on a bukkit server. Can you explain what variable triggers are and how they could solve the issue?
    – rmarenda
    Commented Apr 15, 2013 at 11:21
  • Currently I tp the player in to a testing area, if no one is standing on the pressure plates in the actual area, then they are teleported to the actual area. If someone is standing on the pressure plates, the player gets a message saying, the machine is occupied, and then it teleports them back to the entrance. The problem is when the player either warps out, or drops, the red stone flag may still be left on, so no one can get in until it goes off. I have actually watched it and it does eventually go off if you stand right next to it.
    – rmarenda
    Commented Apr 15, 2013 at 11:28
  • Is there a command that will "refresh" an area, so I could teleport the player in, refresh the area, wait a bit until the refresh is complete, then test to see if the gambling machine is occupied or not.
    – rmarenda
    Commented Apr 15, 2013 at 11:30

Not the answer you're looking for? Browse other questions tagged .