Ulysses

General => Developers Corner => Topic started by: newclear_atomic97 on May 13, 2015, 07:36:14 AM

Title: Scoreboard Name Colour
Post 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.
Title: Re: Scoreboard Name Colour
Post by: allofmywutsteam on May 13, 2015, 08:17:35 AM
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
Title: Re: Scoreboard Name Colour
Post by: Decicus on May 13, 2015, 08:36:04 AM
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)
Code: [Select]
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.
Title: Re: Scoreboard Name Colour
Post by: Tomzen on May 13, 2015, 07:22:22 PM
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)
Code: [Select]
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.