1
Help me with an execute command plz
so i need to make this command for for my friend so that they can have an active team counter and this does not work:
execute if entity @a[team=1,nbt={Health:0.0}] run kick JacobXY_RC
and it does not kick me from my server and yes I'm on a server so this should work.
execute if entity @a[team=1,nbt={Health:0.0}] run kick JacobXY_RC
and it does not kick me from my server and yes I'm on a server so this should work.
10
I have a few questions:
- What is a team counter?
- is the "nbt={Health:0.0}" part to detect whether a player has died? If so, you may consider using a scoreboard objective that counts deaths.
- Is the team in question called '1'?
so idk what you mean by team counter and the nbt health 0.0 shows the player on team 1's health is 0.0 or they are dead then it should kick them and not let them keep playing after they die and the team is question is yes called 1
You can try using a scoreboard to store the number of deaths using:
/scoreboard objectives add died deathCount
and then a repeating command block with the following command to reset it to 0
/execute as @a if score @s died matches 1.. run scoreboard players set @s died 0
Now just do:
/execute as @a if entity @s[team=1, scores={died=1}] run kick @s Dead men must be kicked.
That will basically add a scoreboard called dead to store deaths obviously
then set it to 0 if greater or equal than 1
if its greater than 0 will kick the person.
/scoreboard objectives add died deathCount
and then a repeating command block with the following command to reset it to 0
/execute as @a if score @s died matches 1.. run scoreboard players set @s died 0
Now just do:
/execute as @a if entity @s[team=1, scores={died=1}] run kick @s Dead men must be kicked.
That will basically add a scoreboard called dead to store deaths obviously
then set it to 0 if greater or equal than 1
if its greater than 0 will kick the person.
since my friend is using a scoreboard they want it to show enemy deaths so i need it to show enemy deaths but probably not same team deaths.
also wouldn't that first command block just make it always 0 for everyone? by putting the death back to 0 for you when you die?
also wouldn't that first command block just make it always 0 for everyone? by putting the death back to 0 for you when you die?
The commands are indeed out of order, so try:
~Execute this once
/scoreboard objectives add died deathCount
~Repeating commands (in order)
kick @a[team=1, scores={died=1..}] Dead men must be kicked.
scoreboard players reset @a[scores={died=1..}] died
This creates a deathCount, then every tick kicks any player on team 1 with 1 or more deaths and then resets their deathCount. I also optimized Dissec's commands
~Execute this once
/scoreboard objectives add died deathCount
~Repeating commands (in order)
kick @a[team=1, scores={died=1..}] Dead men must be kicked.
scoreboard players reset @a[scores={died=1..}] died
This creates a deathCount, then every tick kicks any player on team 1 with 1 or more deaths and then resets their deathCount. I also optimized Dissec's commands
Try this. Make sure that it is in a repeating command block, always active, and you are on a team called 1 or it would not work.
kick @a[team=1,nbt={DeathTime:1}]this did not work i did "gamemode spectator @a[team=1,nbt={DeathTime:1}]" instead as to not get repeat kicked if i die but it did not work
Are you sure that you are definitely on a team just called 1?
/team add team 1
/team join 1iirc "kick" command doesn't work in command blocks.
try putting them in spectator mode instead?
try putting them in spectator mode instead?
Is you character in a team names 1 ??
