1

I wanted to make a Mafia map, but when the Mafia kills somebody, it will show the player's name so everybody now knows that the Mafia is that player. In the chat, is there any way to have it say "xXTHEEPICGUYXx was slain by The Mafia" instead of "xXTHEPICGUYXx was slain by Diamondminer456"? I know it doesn't really make much sense but can somebody help me?

1

1 Answer 1

3

First, you will need to turn off death messages: /gamerule showDeathMessages false

Then you will use command blocks to make your own death messages. The easiest way I can think of to do it, is to first make a kill player score and a death score: /scoreboard objectives add killPlayer playerKillCount and /scoreboard objectives add deaths deathCount.

Then you will need four command blocks:

  • Repeating Command Block: /execute @a[score_deaths_min=1] ~ ~ ~ /execute @p[score_killPlayer_min=1,tag=!mafia] ~ ~ ~ /tellraw @a ["",{"selector":"@a[score_deaths_min=1]"},{"text":" was slain by "},{"selector":"@p"}]
  • Chain Command Block: /execute @a[score_deaths_min=1] ~ ~ ~ /execute @p[score_killPlayer_min=1,tag=mafia] ~ ~ ~ /tellraw @a ["",{"selector":"@a[score_deaths_min=1]"},{"text":" was slain by the Mafia"}]
  • Chain Command Block: /scoreboard players reset @a killPlayer
  • Chain Command Block: /scoreboard players reset @a deaths

By the way, the @a[c=1] is necessary because @p does not select dead players. The first command will do death messages for non-mafia players, the second for mafia players, then the last two reset the scores so the message only displays once. Make sure to change tag=mafia and tag=!mafia to whatever you are using to identify the mafia players.

Hope this helps! :D

1
  • I found another way, I could make the mafia vote for somebody to kill then I can kill them because I won't be playing, The same person will kill them every time
    – user181699
    Jun 3, 2017 at 17:16

You must log in to answer this question.