Jump to content

change name color


Recommended Posts

Posted (edited)

Here's an example:

 

-- Server side

function fixColors(player) -- making a function
  	local team = getPlayerTeam(player) -- getting player's team
  	if team then -- checking if the player is in a team
		local r, g, b = getTeamColor(team) -- get the team's color
		setPlayerNametagColor(player, r, g, b) -- set player color to his team.
    end -- first if end
end -- function end
addCommandHandler("fix", fixColors) -- command

 

Edited by HassoN
  • 2 years later...
Posted (edited)
hello, if your problem is still valid, I would like to leave this code here, it will be useful for you.

if content then
	if column.name == "name" then
		r, g, b = getPlayerNametagColor( element )
	elseif column.name == "Team" then
		-- content here is the rank name, set the color how you want it to be.
		if content == "TEAMNAME" then
			r = 100
			g = 100
			b = 255
		else
			r = 255
			g = 255
			b = 255
		end
	end
end
 @Giovany Mito

you can write on the client side of the scoreboard

Edited by eoL|Shady
  • Human Resources Staff
Posted
12 minutes ago, eoL|Shady said:
hello, if your problem is still valid, I would like to leave this code here, it will be useful for you.

if content then
	if column.name == "name" then
		r, g, b = getPlayerNametagColor( element )
	elseif column.name == "Team" then
		-- content here is the rank name, set the color how you want it to be.
		if content == "TEAMNAME" then
			r = 100
			g = 100
			b = 255
		else
			r = 255
			g = 255
			b = 255
		end
	end
end
 @Giovany Mito

you can write on the client side of the scoreboard

Please don't bump old topics and stick to new ones.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...