Using Command blocks to track a specific player's player kills
I'm trying to get command blocks to track ONLY one specific player's kills, specifically player kills.
So far I have tried:
/scoreboard objectives add Kills stat.playerKills
/testfor EpicMinecartz [score_Kills=2,score_Test_Kills=1]
/scoreboard objectives remove Kills
/scoreboard objectives add Kills stat.playerKills
All linked up with repeaters.
So, all this is fine but the first command block pulls up an error upon activation:
[11:08:02] /testfor <player>
So, my question is:
In 1.7.9 Is there a way to track one player's kills not using @p or @a or @r to track basically everybody?
Best Answer
1.8 and later
/scoreboard players reset removes a player's score in a specified objective completely, making it so that the player doesn't show up in the sidebar display slot.
First, set up a kill counter objective
/scoreboard objectives add killCounter playerKillCount Kills
Set up a 20 Hz. clock (or use 1.9's repeat/chain command blocks) and have it run:
/scoreboard players reset @a[name=!<player>]
where <player> is replaced by the player's name. If you want to track more than one player's kills, you have to figure how to target all players whose kills you don't want to track. Most of the time, you should already know how to select these players based on how they were selected to be shown in the first place. If not, a simple way to do this is to use the scoreboard tags introduced in 1.9:
/scoreboard players tag <player> add trackKills
where <player> is replaced by the player's name or a valid target selector. Run this once for every player to be tracked, then use @a[tag=!trackKills] in the scoreboard reset command above.
1.7
Without reset, we'll need two objectives. One to track all players' player kills, and one to store kills for certain players:
/scoreboard objectives add killCounter playerKillCount
/scoreboard objectives add selectKillCount dummy Kills
Set up a 20 Hz. clock and have it run these commands in order:
/scoreboard players add @a[name=<player>,score_killCounter_min=1] selectKillCount 1
/scoreboard players set @a killCounter 0
Replace <player> with the name of the player to track. When tracking more than one player, you'll have to assign them some score in another dummy objective and use that in the target selector instead of name.
Pictures about "Using Command blocks to track a specific player's player kills"



How do you know if someone has killed someone in Minecraft?
The usual way to test for dead players is to set up a scoreboard objective. Check out the linked wiki page for general information, as well as the command reference for using scoreboards. For an unknown number of players detecting the last man standing can be tricky, but it's doable.How do you show player kills in Minecraft?
@p (Nearest Player) If a command block has executed the command, the nearest player to the command block will be targeted. If you run a command from the Chat window, the player running the command will be the nearest player.How do you get a command block to target a player?
Only operators can see command output from players. And now, if you run your command through the command block, no one will be able to see the output in chat. However, the /give and /gamerule commands you did will still be visible in chat.How to detect a player using command blocks! | /execute command tutorial for 1.16 Minecraft Java
More answers regarding using Command blocks to track a specific player's player kills
Answer 2
What you can do is create a scoreboard with the code:
/scoreboard objectives add [new name of scoreboard] playerKillCount
Then you CAN show it in the sidebar with the code:
/scoreboard objectives setdisplay sidebar [name of scoreboard]
Then to add a player you must:
/scoreboard players add [player name] [scoreboard name] 1
/scoreboard players remove [player name] [scoreboard name] 1
Unfortunately there is NO way to show the scoreboard to one player/team unless you include 1.8, but you asked about 1.7.9 and not 1.8, so the answer is unfortunately no.
Then you may see nothing in the scoreboard but as soon as someone get a kill(must be a player unless you use totalKillCount instead of playerKillCount), it will show up in the scoreboard
Answer 3
You can create a new objective:
/scoreboard objectives add EpicMinecartzSelector dummy
Then add yourself with a score of 1:
/scoreboard players add EpicMinecartz EpicMinecartzSelector 1
And then in your testfor, just add
/testfor @a[score_Kills=2,score_Test_Kills=1, score_EpicMinecartzSelector=1]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Fardad Postwala, Charles Parker, Eren Li, Eren Li
