Ulysses
General => Developers Corner => Topic started by: newclear_atomic97 on May 13, 2015, 07:36:14 AM
-
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.
-
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
-
There's also a clientside hook (http://ttt.badking.net/guides/hooks) 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)
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 )
I haven't done Lua in a good while, so someone should correct me if I'm wrong.
-
There's also a clientside hook (http://ttt.badking.net/guides/hooks) 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)
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 )
I haven't done Lua in a good while, so someone should correct me if I'm wrong.
Looks about right.