How to detect & count Kills/Deaths to rank players and move them between arenas?
I am working on a server and trying to make a command block that detects your kills (and if possible your Kill/Death Ratio).
Once you get 10 kills (and if possible a 25%+ K/D Ratio), You rank up to the next arena that has different kill and (if possible K/D Ratio) requirements. I'm looking for someone that can basically show me how to do this with command blocks, because all of the plugins I have tried don't do what I'm asking. If anyone can help me out I would gladly appreciate it.
Set up four objectives:
/scoreboard objectives add deaths deathCount Deaths
/scoreboard objectives add kills playerKillCount Kills
^ OR totalKillCount if you want mob kills to count
/scoreboard objectives add kdr dummy Kill Death Ratio
/scoreboard objectives add arena dummy Arena
Also set up this score beforehand:
/scoreboard players set #1000 kdr 1000
And make sure every player in the first arena has arena
= 1.
Now, run these commands on a loop:
execute @a ~ ~ ~ scoreboard players operation @s kdr = @s kills
scoreboard players operation @a kdr *= #1000 kdr
execute @a ~ ~ ~ scoreboard players operation @s kdr /= @s deaths
# Now every players' kdr score stores their kill-death-ratio,
# times 1000 so that we don't lose the fraction.
say Moving on to Arena 2: @a[score_arena_min=1,score_arena=1,score_kdr_min=250,score_kills_min=10]
scoreboard players set @a[score_arena_min=1,score_arena=1,score_kdr_min=250,score_kills_min=10] arena 2
And do whatever teleporting you need.