Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 11:17:06 PM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Help with coloured names?
Pages: [1] 2
Author Topic: Help with coloured names?  (Read 10537 times)
PurpleHaze
Poster

Posts: 10


« on: August 30, 2010, 04:25:47 AM »

Ok, I want to know how to get coloured admin names and donator what do i change? And where do i goto. :D thanks.
PAL-18
Poster

Posts: 36



« Reply #1 on: August 30, 2010, 06:10:17 AM »

I need to know too.

I tried changing the code in cl_scoreboard.lua on line 9

Quote
local namecolor = {
  Admin = Color(255, 204, 0, 255)
};


I have the admin group set in "settings\users.txt" and the name color still does not display in the chat area or on the scoreboard.

Also, when i set a second line below it for another group, the scoreboard breaks.

Quote
local namecolor = {
  Admin = Color(255, 204, 0, 255)
  Donator = Color(204, 0, 255, 255)
};


What syntax am i missing for 2 lines of groups and how to i get those group colors to display ingame?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #2 on: August 30, 2010, 08:11:33 AM »

Quoting the readme:

There's also a hook for scoreboard name colors:
- TTTScoreboardColorForPlayer
   
It's clientside, and you could use it as follows. Put the below in a text file
in \garrysmod\lua\autorun\ on the server, called scoreboardcolors.lua:

   if SERVER then
      -- when the server loads this script, tell it to send it to clients
      AddCSLuaFile("scoreboardcolors.lua")
   else
      -- when a client runs it, add the hook
      function MySBColors(ply)
         if ply:SteamID() == "PUT A STEAMID HERE" then
            return Color(255, 0, 255)
         end
      end
      hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
   end

Edit in a SteamID to test with, of course. Adding more players and changing
colors should be easy from there.

You will need to know a bit of Lua, or perhaps someone else here is going to be very helpful and do it for you.

Don't edit TTT files directly.

If the default yellow names for admins are not showing up, they are not set up properly, or ttt_highlight_admins is 0.
Sam
Poster

Posts: 22



« Reply #3 on: August 30, 2010, 01:11:56 PM »

I would recommend using the code below which is a slight modification of what BadKing posted. This one simply detects whether the player is a Super Admin or Admin. If you would like to use a custom usergroup, use this: ply:IsUserGroup()
if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
      if ply:IsSuperAdmin() or ply:IsAdmin() then
        return Color(255, 0, 255)
      end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end

Use the same installation method that BadKing posted above this post.

http://www.steamcommunity.com/id/samm5506
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #4 on: August 30, 2010, 04:14:29 PM »

I would recommend using the code below which is a slight modification of what BadKing posted. This one simply detects whether the player is a Super Admin or Admin. If you would like to use a custom usergroup, use this: ply:IsUserGroup()
if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
     if ply:IsSuperAdmin() or ply:IsAdmin() then
        return Color(255, 0, 255)
     end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end

Use the same installation method that BadKing posted above this post.



sorry where can i find the colour codes? like i dont know what blue is etc.

example:


if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
     if ply:IsUserGroup("Respected") then
        return Color(255, 0, 255)  <---  i want blue / cyan
     end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end
« Last Edit: August 30, 2010, 04:26:41 PM by simmerdown »
James
Poster

Posts: 12


« Reply #5 on: August 30, 2010, 04:34:10 PM »

http://html-color-codes.com/rgb.html
Sam
Poster

Posts: 22



« Reply #6 on: August 30, 2010, 05:51:43 PM »

sorry where can i find the colour codes? like i dont know what blue is etc.

The format is on this webpage: http://wiki.garrysmod.com/?title=Color

Use this color wheel to get the red, green, and blue (RGB) values you want. Then insert those into the color format like so:
Color(108,177,236)

That is a cyan color that I got from the Color Wheel I linked.

http://www.steamcommunity.com/id/samm5506
PAL-18
Poster

Posts: 36



« Reply #7 on: August 30, 2010, 08:05:09 PM »

I can't get it working.  I'm trying to define groups of users.txt

Quote
if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
     if ply:IsUserGroup("Admin") then
        return Color(255, 204, 0)
     end
     if ply:IsUserGroup("Donator") then
        return Color(204, 0, 255)
     end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end


I restarted the server and the colors dont show.
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #8 on: August 30, 2010, 08:05:40 PM »

The format is on this webpage: http://wiki.garrysmod.com/?title=Color

Use this color wheel to get the red, green, and blue (RGB) values you want. Then insert those into the color format like so:
Color(108,177,236)

That is a cyan color that I got from the Color Wheel I linked.  <--- thank you very much
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #9 on: August 30, 2010, 08:18:03 PM »

code doesnt work for me neither

i placed it in :
/ip+port/orangebox/garrysmod/lua/autorun/server 


if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
      if ply:IsUserGroup("Respected") then
        return Color(108,177,236)
      end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #10 on: August 30, 2010, 08:37:47 PM »

Ulx doesn't have ranks with capital letters...

if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
     if ply:IsUserGroup("respected") then
        return Color(108,177,236)
     end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end


Try that?

if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
      if ply:IsUserGroup("admin") then
        return Color(255, 204, 0)
      end
      if ply:IsUserGroup("donator") then
        return Color(204, 0, 255)
      end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end
« Last Edit: August 30, 2010, 08:41:42 PM by Mr. Gash »
PAL-18
Poster

Posts: 36



« Reply #11 on: August 30, 2010, 08:44:16 PM »

I dont use ULX though, i have the groups defined in settings\users.txt.

P.S. In fact i dont use any gmod admin tool, i use sourcemod.
Sam
Poster

Posts: 22



« Reply #12 on: August 30, 2010, 08:46:44 PM »

simmerdown, Lua is case-sensitive, so make sure that the user group you created in settings/users.txt has the exact same name in as in the IsUserGroup() function.

Also make sure that you named the file scoreboardcolors.lua
« Last Edit: August 30, 2010, 08:52:51 PM by Sam »

http://www.steamcommunity.com/id/samm5506
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #13 on: August 30, 2010, 09:00:48 PM »

simmerdown, Lua is case-sensitive, so make sure that the user group you created in settings/users.txt has the exact same name in as in the IsUserGroup() function.

Also make sure that you named the file scoreboardcolors.lua



ooooh right,  is there anyway i could use the evolve file in  data/ev_playerinfo.txt  instead of the  settings/users.txt  ? 


sorry.
PAL-18
Poster

Posts: 36



« Reply #14 on: August 30, 2010, 09:15:09 PM »

I finally got the code working (somewhat), but rather than display the color i want, its displaying the default admin color and ttt_highlight_admins is set to 0
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #15 on: August 30, 2010, 09:15:52 PM »

Post the code?
PAL-18
Poster

Posts: 36



« Reply #16 on: August 30, 2010, 09:50:51 PM »

It's the same code i posted earlier except i changed both group names to all lowercase.

Quote
if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
     if ply:IsUserGroup("admin") then
        return Color(255, 204, 0)
     end
     if ply:IsUserGroup("donator") then
        return Color(204, 0, 255)
     end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end


I didn't know which folder to save it into, so the file is in lua\autorun and lua\autorun\server
« Last Edit: August 30, 2010, 09:51:55 PM by PAL-18 »
simmerdown
Poster

Posts: 70

www.ms3dguns.com


« Reply #17 on: August 31, 2010, 06:43:25 PM »

still doesnt work

Settings/users.txt:

"respected"
{
"STEAM_0:0:#######";
"STEAM_0:0:#######";
"STEAM_0:0:#######";
"STEAM_0:1:#######";
"STEAM_0:1:#######";
"STEAM_0:0:#######"
}



lua/autorun/server/scoreboardcolors.lua

if SERVER then
  AddCSLuaFile("scoreboardcolors.lua")
else
  function MySBColors(ply)
      if ply:IsUserGroup("respected") then
        return Color(108,177,236)
      end
  end
  hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
end






or like i could do:  "STEAM_0:0:##########"; // player name, with out it gets a command so i know which steam id is from what player.


or do i have to seperate them on a different way or? i dont know any lua this if only what i remember of pawno that if u wanan keap same command for  multiple things u  add a ; on end, or do i have to seperate them differently,   or i have to add more then just steam id?
« Last Edit: August 31, 2010, 07:10:07 PM by simmerdown »
PAL-18
Poster

Posts: 36



« Reply #18 on: August 31, 2010, 08:42:00 PM »

Quoting the readme:

There's also a hook for scoreboard name colors:
- TTTScoreboardColorForPlayer
 
It's clientside, and you could use it as follows. Put the below in a text file
in \garrysmod\lua\autorun\ on the server, called scoreboardcolors.lua:

  if SERVER then
      -- when the server loads this script, tell it to send it to clients
      AddCSLuaFile("scoreboardcolors.lua")
  else
      -- when a client runs it, add the hook
      function MySBColors(ply)
        if ply:SteamID() == "PUT A STEAMID HERE" then
            return Color(255, 0, 255)
        end
      end
      hook.Add("TTTScoreboardColorForPlayer", "MySBColors", MySBColors)
  end

Edit in a SteamID to test with, of course. Adding more players and changing
colors should be easy from there.

You will need to know a bit of Lua, or perhaps someone else here is going to be very helpful and do it for you.

Don't edit TTT files directly.

If the default yellow names for admins are not showing up, they are not set up properly, or ttt_highlight_admins is 0.


I tried that code too and it doesnt work either.  Does it go in "\garrysmod\lua\autorun\" or "\garrysmod\lua\autorun\server\" ?
Bad King Urgrain
Administrator
*****
Posts: 12276



« Reply #19 on: August 31, 2010, 09:00:48 PM »

It works on my local srcds, with the only change of putting my own steamid in there. It goes in \garrysmod\lua\autorun\

If you use fastdl, then after adding it you'll have to do the usual routine of loading a map on the server so it generates a Lua cache, and then putting that on the fastdl sever.
« Last Edit: August 31, 2010, 09:01:53 PM by Bad King Urgrain »
Pages: [1] 2
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Help with coloured names? « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.01 seconds with 18 queries.