How can i insta-kill players when they are in water? The water is below Parkour. Is there anyway to have a /testfor which tests if the player is in water, then if true does /kill?
This will work however if multiple people are on then this could kill the wrong player, since @p cannot target dead players while @a can. So if you execute @a and then target @p, it will target the nearest living player, which may not be the right one (a player could fall into a pool of water, die, not respawn, and then the @p just targets the next closest player). To fix this change the @p to @a[c=1]. Since @a targets dead players and c=1 creates sender bias, it acts like @p but doesn't target the wrong player
This will work however if multiple people are on then this could kill the wrong player, since @p cannot target dead players while @a can. So if you execute @a and then target @p, it will target the nearest living player, which may not be the right one (a player could fall into a pool of water, die, not respawn, and then the @p just targets the next closest player). To fix this change the @p to @a[c=1]. Since @a targets dead players and c=1 creates sender bias, it acts like @p but doesn't target the wrong player
/execute @a ~ ~ ~ detect ~ ~ ~ minecraft:water 0
<span style="font-family: arial,helvetica,sans-serif;">would be better as it would detect when he is <em>in</em> the water, not <em>above</em>...</span>
Rollback Post to RevisionRollBack
You know that you are lazy when you do a program to write a program
/execute @a ~ ~ ~ detect ~ ~ ~ minecraft:water 0
<span style="font-family: arial,helvetica,sans-serif;">would be better as it would detect when he is <em>in</em> the water, not <em>above</em>...</span>
The affect is the same either way, so it wouldn't matter, unless OP has situations where water is able to be crouched over. Since he said this is for a parkour map , I doubt that is case.
Is there a command to test if a player is in Water? It would be a lot more quick and simple.
That's literally what everyone has been posting. Each command that has been posted on this thread will work. There is no command that only detects if the user is in water. You need to use execute detect and check for the water block, which is what everyone has posted.
That's literally what everyone has been posting. Each command that has been posted on this thread will work. There is no command that only detects if the user is in water. You need to use execute detect and check for the water block, which is what everyone has posted.
Sorry, I'm really new to commands.
So if I use any of these commands it insta-kills any player who is in water?
@p already means the nearest player. And as it's the player himself who's detecting the water and executing the command at his position, I don't think @a[c=1] does anything else...
@p mean closest player that is ALIVE
if the player is dead, but doesnt press respawn, other players will die.
@a[c=1] is the nearest player, dead or alive.
This way, it will only kill the player in the water.
Hello,
How can i insta-kill players when they are in water? The water is below Parkour. Is there anyway to have a /testfor which tests if the player is in water, then if true does /kill?
/execute @a ~ ~ ~ detect ~ ~-1 ~ minecraft:water 0 /kill @p
This will work however if multiple people are on then this could kill the wrong player, since @p cannot target dead players while @a can. So if you execute @a and then target @p, it will target the nearest living player, which may not be the right one (a player could fall into a pool of water, die, not respawn, and then the @p just targets the next closest player). To fix this change the @p to @a[c=1]. Since @a targets dead players and c=1 creates sender bias, it acts like @p but doesn't target the wrong player
I think that
You know that you are lazy when you do a program to write a program
Consider using a tp command instead of /kill, since it is quicker and more convenient for the player.
My projects: https://blockbench.net/hub
Okay, one quick question. You have the co-ords just in one spot, but the water is everywhere.
The affect is the same either way, so it wouldn't matter, unless OP has situations where water is able to be crouched over. Since he said this is for a parkour map , I doubt that is case.
Is there a command to test if a player is in Water? It would be a lot more quick and simple.
That's literally what everyone has been posting. Each command that has been posted on this thread will work. There is no command that only detects if the user is in water. You need to use execute detect and check for the water block, which is what everyone has posted.
Sorry, I'm really new to commands.
So if I use any of these commands it insta-kills any player who is in water?
yes. However if this is for multiplayer, do not use a command like
Use @a[c=1] instead of @p, for the reasons I have already mentioned. But just as Jannis said, you should use /tp instead of /kill.
And I put this in a repeating always active Command Block right?
you can, or add it to an existing clock using a chain command block. it depends on how you have everything else set up
Okay.
Thanks so much! You guys are awesome! Sorry for being such a noob
@p mean closest player that is ALIVE
if the player is dead, but doesnt press respawn, other players will die.
@a[c=1] is the nearest player, dead or alive.
This way, it will only kill the player in the water.
YouTube: https://www.youtube.com/channel/UCzGDRYWcrGreMmQFo_d5N5Q
Facebook:https://goo.gl/s0r12d
Website:https://theusaf.weebly.com
JavaScript Projects: https://theusaf.github.io
Link Shortener: https://shortr.github.io
Twitter:https://www.twitter.com/theusafyt
Because the player is dead, doesnt mean that command blocks cant see him, and his coords.
YouTube: https://www.youtube.com/channel/UCzGDRYWcrGreMmQFo_d5N5Q
Facebook:https://goo.gl/s0r12d
Website:https://theusaf.weebly.com
JavaScript Projects: https://theusaf.github.io
Link Shortener: https://shortr.github.io
Twitter:https://www.twitter.com/theusafyt
This is not the easiest way, by far. the easiest way would be to use execute detect, which has already been stated multiple times.