Page 1 of 1

How change players nicknames color?

PostPosted: Sun Feb 14, 2016 16:14
by amadin
Hello. How change color of players nicknames on server side? I can change source code if needed.

Re: How change players nicknames color?

PostPosted: Sun Feb 14, 2016 18:48
by rubenwardy

Re: How change players nicknames color?

PostPosted: Sun Feb 14, 2016 18:51
by kaadmy
What is your goal? Change the player nametag (not name, but nametag) for different players?
Changing the name's color is currently impossible, but the nametag is now changeable.

Putting this in a mod should make admins have a red nametag.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
local admins = {"amadin"}

minetest.register_on_joinplayer(function(player)
  for _, n in pairs(admins) do
    if player:get_player_name() == n then
      player:set_nametag_attributes({color = "red"})
      break
    end
  end
end)

Re: How change players nicknames color?

PostPosted: Sun Feb 14, 2016 19:03
by rubenwardy
You can change the nametag's color, so the name that floats above the head. But you can't change the chat color. I'm guessing he meant the former.