Author Topic: Scoreboard Name Colour  (Read 2124 times)

0 Members and 2 Guests are viewing this topic.

Offline newclear_atomic97

  • Newbie
  • *
  • Posts: 10
  • Karma: 0
Scoreboard Name Colour
« 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.

Offline allofmywutsteam

  • Full Member
  • ***
  • Posts: 136
  • Karma: 3
  • MNWO Owner
    • MNWO Discord
Re: Scoreboard Name Colour
« Reply #1 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
"Then Jesus said to his disciples, 'Whoever wants to be my disciple must deny themselves and take up their cross and follow me.'" - Matthew 16:24



MNWO: Steam | Discord | Website | Join Server

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: Scoreboard Name Colour
« Reply #2 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: [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.
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: Scoreboard Name Colour
« Reply #3 on: May 13, 2015, 07:22:22 PM »
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: [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.
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==