General > Developers Corner
Scoreboard Name Colour
(1/1)
newclear_atomic97:
I am wanting to know how you change name colours in the scoreboard ( I.E. Admins being yellow/orange ) But im wanting Owner and Co-Owner different colours too
Could you link me to a fourm or website that does a tutorial or guide please
Thanks.
allofmywutsteam:
Go to /garrysmod/gamemodes/terrortown/gamemode/cl_scoreboard.lua
change the admin = Color(), and add within the function
Don't quote me on this. I just did a quick search, but this seems like a simple solution. I would tweak it and test results of course
Decicus:
There's also a clientside hook where you can change colors without modifying the gamemode code.
A quick example would be to put this into <GarrysMod dir>/lua/autorun/client/namecolors.lua ("namecolors" can be whatever you want)
--- Code: ---local Namecolors = {
[ "owner" ] = Color( 255, 0, 0 ), -- Red
[ "co-owner" ] = Color( 0, 255, 0 ), -- Green
[ "moderator" ] = Color( 0, 0, 255 ) -- Blue
}
hook.Add( "TTTScoreboardColorForPlayer", "GroupNamecolors", function( ply )
if Namecolors[ ply:GetUserGroup() ] then
return Namecolors[ ply:GetUserGroup() ]
else
return nil
end
end )
--- End code ---
I haven't done Lua in a good while, so someone should correct me if I'm wrong.
Tomzen:
--- Quote from: Decicus on May 13, 2015, 08:36:04 AM ---There's also a clientside hook where you can change colors without modifying the gamemode code.
A quick example would be to put this into <GarrysMod dir>/lua/autorun/client/namecolors.lua ("namecolors" can be whatever you want)
--- Code: ---local Namecolors = {
[ "owner" ] = Color( 255, 0, 0 ), -- Red
[ "co-owner" ] = Color( 0, 255, 0 ), -- Green
[ "moderator" ] = Color( 0, 0, 255 ) -- Blue
}
hook.Add( "TTTScoreboardColorForPlayer", "GroupNamecolors", function( ply )
if Namecolors[ ply:GetUserGroup() ] then
return Namecolors[ ply:GetUserGroup() ]
else
return nil
end
end )
--- End code ---
I haven't done Lua in a good while, so someone should correct me if I'm wrong.
--- End quote ---
Looks about right.
Navigation
[0] Message Index
Go to full version