1

I need help with a command

thereaper908 •12/28/15 10:58 am
•
280
•
12/28/2015 11:23 am
Does anyone know any commands that can detect when a player dies and then give that player an item when they respawn. I'm building a server map and i can't figure out how to give a player a command book when they respawn.
Posted by
thereaper908
Level 1 : New Miner
0

  Have something to say?

Join • Sign in

3

thereaper908
• 12/28/2015 11:23 am
• Level 1 : New Miner
Thanks David, that got it to work.
1
davidthorpester
• 12/28/2015 11:07 am
• Level 18 : Journeyman System
I think the best thing would be to use the stat.timeSinceDeath scoreboard stat.

if you do:

/scoreboard objectives add timesincedeath stat.timeSinceDeath

Then you can give the book to anyone with a timesincedeath score less than say 100

/give @p[score_timesincedeath=100] minecraft:book etc...

To stop the person getting loads of books in the first 100 ticks since death you will need a command that runs straight afterwards to stop them receiving more than 1 book, something like:

/scoreboard players set @a[score_timesincedeath=100] timesincedeath 101

Once their score is set to more than 100 they will not receive any more books. In 1.9 snapshots its really easy to sequence the commands using the chain command blocks, otherwise in 1.8 you will need a fill clock that runs in the correct order.

Hope this helps, David
1
notfegel
• 12/28/2015 11:04 am
• Level 5 : Apprentice Warrior
Why? There is /help for that
1

Welcome