I'm trying to add colors to certain groups so that instead of just admins being highlighted that donators would be and regulars and so on. I have this bit of code but I'm not really sure where i'd put in like a thing to check the usergroup? Can i get some help?
[CODE]function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsAdmin() then
return Color(0, 255, 241, 255)
end
end[/CODE]
This code is from my deathruns cl_init.lua btw
Could do:
[lua]if ply:IsUserGroup("SuperOwnerOfTheWorld") then return Color(0,0,255,255) end[/lua]
Obviously then just add more for each rank you have.
Just like add that on instead of the if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsAdmin() then
return Color(0, 255, 241, 255)
-snip-
idk that was what it said in my code for the server lol
-Snip, stupidity on my part-
Let's see it came up here : [QUOTE]local highlight = CreateConVar( "dr_highlight_admins", "1", FCVAR_ARCHIVE )[/QUOTE]
Anyway, yes. Just add separate checks like it.
[lua]
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("Donator") then
return Color(0, 255, 0, 255)
end
[/lua]
Do make it kinda all in one function or do i make a separate one for each individual group
[editline]29th December 2013[/editline]
[QUOTE]function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsAdmin() then
return Color(0, 255, 241, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("Donator") then
return Color(0, 255, 13, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("Regular") then
return Color(255, 153, 0, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("newbie") then
return Color(147, 153, 152, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("respected") then
return Color(189, 248, 52, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("Trusted") then
return Color(224, 144, 247, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("operator") then
return Color(0, 255, 241, 255)
end
end
function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("doperator") then
return Color(0, 255, 241, 255)
end
end[/QUOTE]
Like this? I'm sorry if I seem dumb. I just really have no idea when it comes to this scoreboard. :/
[editline]29th December 2013[/editline]
I did the above code and now everyone is just not highlighted lol
If you do that either the last or first will overwrite the rest (can't remember which one). You need to put all of them in one function.
[lua]function GM:GetScoreboardNameColor( ply )
if not IsValid(ply) then return Color( 255, 255, 255, 255 ) end
if ply:SteamID() == "STEAM_0:1:38699491" then return Color(0, 255, 241, 255) end -- Please don't change this.
if GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("catscats") then
return Color(rgba)
elseif GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("cats") then
return Color(rgba)
elseif GetGlobalInt( "dr_highlight_admins" ) == 1 and ply:IsUserGroup("dogs") then
return Color(rgba)
end
end[/lua]
Untested but that should work.
Thanks!! That worked!
Sorry, you need to Log In to post a reply to this thread.