1
I need help with a command
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.
3
Thanks David, that got it to work.
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
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
Why? There is /help for that
