Minecraft command block: allow user on server to spawn one animal (per user)
Solution 1:
Scoreboards!
You can track a user with scoreboards. The main gist is:
If a user has an
hasOcelot
score of 1 presses the button, do nothing.
If a user has anhasOcelot
score of 0 presses the button, spawn an Ocelot. Give the current player who pressed the button a score forhasOcelot
of 1.
Where hasOcelot
is a score of type 'dummy' that you use to keep tabs on who has spawned an Ocelot and who hasn't.
You can use the /testfor
command with the radius and score selectors to see if the player fits into the criteria.
tl;dr
Chain command blocks like this:
/testfor @p[r=2,score_hasOcelot_max=0]
(Check if user hasn't spawned)/summon ~ ~1 ~ minecraft:Ocelot
(Summon if the previous/testfor
was true)/scoreboards players set @p[r=2,score_hasOcelot_max=0] hasOcelot 1
(mark him as having an ocelot spawned, continuation of chain)
Note: I might've messed up some selectors due to changes between 1.9 and now.