As of writing this, I'm am working a lot to make a good Gmod Murder Server. What I figured out pretty quickly was that there is not much info on the murder gamemode. It has already taken me hours of reading through the files to do what I want, and I believe there are more hours to come. Therefore, I wanted to make this to show at least one of the things I've learned: Changing the colors on the scoreboard.
In most gmod gamemodes, there is a scoreboard which opens when you hold "tab". In Gmod murder, this is how the default setup is: Players are blue, spectators are gray and admins/superadmins are red with a wand by their name. To me that is a very dull setup. Now how can one make it cooler without having to redesign the entire gamemode?
I got the idea from another server: Having ranks and let every rank have its own color. Make a rainbow out of the <censor> scoreboard! yeah! But how? This is when I figured out that I had to find out my self. Here is what I did:
1. Get ULX!!! This is so useful that I think valve should include it in the serverfiles itself! The more extra stuff you have for you ULX, the better!!
2. Create your groups in ULX. Just go on you server and make the groups from the xgui there, it's much easier than editing files. In the server I'm making, I made 12 groups (11+users), but the only limit is how much work you want to put into it (or the memory of the disk)
3. Now it's time to edit some files! go to garrysmod\settings and open the users.txt. Here you will find this:
"superadmin"
{
//"garry" "STEAM_0:1:7099"
}
"admin"
{
//"garry" "STEAM_0:1:7099"
}
Here you just need to copy the pattern and make a line for every group. Give them the same names as the ULX groups.
"superadmin"
{
//"garry" "STEAM_0:1:7099"
}
"admin"
{
//"garry" "STEAM_0:1:7099"
}
"operator"
{
//"garry" "STEAM_0:1:7099"
}
"TrialOperator"
{
//"garry" "STEAM_0:1:7099"
}
"trusted"
{
//"garry" "STEAM_0:1:7099"
}
You do not need to care about the "garry" and the steamid, they are not important
Above all of this in the same file, it gives you a code for how to use the groups in other files (pl:IsUserGroup( "<group>" ). However, the murderfiles don't use pl to mark a player, it uses "ply". Therefor we must use "ply:IsUserGroup( "<group>" )".
4. Go to garrysmod\gamemodes\murder\gamemode and open cl_scoreboard.lua. You will be looking for this part:
if IsValid(ply) && showAdmins && ply:IsAdmin() then
surface.SetDrawColor(Color(185,174,14))
The color is not default because I have changed it, this is where we do that. But one thing at the time.
This line says that if the player is an admin/superadmin, then that person will have the color that is indicated by the three numbers. One thing that I wanted to do was to separate the two types of admins. To do that, we must change the "ply:IsAdmin()" with one line that goes for "ply:IsUserGroup("superadmin")" and one for "ply:IsUserGroup("admin")":
if IsValid(ply) && showAdmins && ply:IsUserGroup("superadmin") then
surface.SetDrawColor(Color(185,174,14))
elseif IsValid(ply) && showAdmins && ply:IsUserGroup("admin") then
surface.SetDrawColor(Color(185,0,0))
If you are new to coding, do notice that only the first line have if as the first word, while the others have elseif. Here you can add a lot of lines:
if IsValid(ply) && showAdmins && ply:IsUserGroup("superadmin") then
surface.SetDrawColor(Color(185,174,14))
elseif IsValid(ply) && showAdmins && ply:IsUserGroup("admin") then
surface.SetDrawColor(Color(185,0,0))
elseif IsValid(ply) && showAdmins && ply:IsUserGroup("operator") then
surface.SetDrawColor(Color(10,111,20))
elseif IsValid(ply) && showAdmins && ply:IsUserGroup("TrialOperator") then
surface.SetDrawColor(Color(63,215,47))
elseif IsValid(ply) && showAdmins && ply:IsUserGroup("trusted") then
surface.SetDrawColor(Color(215,0,215))
5. Now we need to find the colors. The three number are the keys! They are coded after RGB (Red-Green-Blue) codes. Follow this link to find colors quickly:
http://www.rapidtables.com/web/color/RGB_Color.htmIf you plot in the numbers I have for superadmins, it will show a golden color.
6. Haven't we already done what I set out to do? Yes, but there is one last thing: the wand. By default only superadmins and admins have this, but in my case, I also wanted the operators and TrialOperators to have it. To do this, we must continue to work in the cl_scoreboard.lua. First we must look for this line:
if showAdmins && ply:IsAdmin() then
surface.SetMaterial(admin)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(s + 4, h / 2 - 16, 32, 32)
s = s + 32
end
As you can see, once again we have the "ply:IsAdmin()". This means that if you wanted to, you could split them up the same way we did before, but since I want both admins and superadmins to have the wand, it serves no purpose to do that. Instead we copy the entire thing, paste them under one another and change it for the other groups.
if showAdmins && ply:IsAdmin() then
surface.SetMaterial(admin)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(s + 4, h / 2 - 16, 32, 32)
s = s + 32
end
if showAdmins && ply:IsUserGroup("operator") then
surface.SetMaterial(admin)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(s + 4, h / 2 - 16, 32, 32)
s = s + 32
end
if showAdmins && ply:IsUserGroup("TrialOperator") then
surface.SetMaterial(admin)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(s + 4, h / 2 - 16, 32, 32)
s = s + 32
end
The thing that actually adds the wand, is the line "surface.SetMaterial(admin)". If you change the word "admin" with "muted", then it will show the muted symbol for that group, but this can get confusing if you actually mute someone.
That is how to do it! It is a very manual way of doing it. I'm very new to coding myself, and to be honest, I'm not sure if step 3 is needed. However, if you include step 3, I know that it will work. The nice thing is that this works with ULX, so if you move someone to another group in-game, it will update automatically. This makes for a colorful scoreboard in gmod murder.
Hope this was understandable. Please do ask questions, although I can not guarantee a good answer.
ZackLeim
PS: Check out my murder server when I get it up and running.
IP: 185.28.189.87:27015