How can I match colors of the voice indicator to people in ULX groups?
7 replies, posted
Heres what I mean, this box thing: [IMG]http://i44.tinypic.com/2l9mrsw.png[/IMG]
I want it to match the colors of what position players are in, for example if they are in super admin, i want to make the box color light blue like their name in the playerlist, I've posted this in general discussion for GMOD, but people said that I should repost it here.
For ULX groups, I want to match the voice indicator that pops up when you hit X to the color of the group for ULX, so it looks like above, so when a member is on, their voice indicator is orange, when a admin is on, theirs is red, when moderator is on, theirs is green, and when super admin is on, theirs is light blue.
How can I do this?
[editline]14th November 2013[/editline]
Oh yea, I reposted this here instead because I know I'll probably get more help here on something like this.
you could make a table
[LUA]
local VCColors = {}
VCColors["superadmin"] = Color( 255, 100, 100 )
VCColors["admin"] = Color( 200, 100, 100 )
VCColors["donator"] = Color( 100, 255, 100 )
[/LUA]
then find the line where the color is defined, and do something like
[LUA]
local c = VCColors[talker:GetNWString( "usergroup" )]
panel:SetColor( c and c or Color( 255, 255, 255 ) )
[/LUA]
@rejax
I feel stupid to ask this, but can you compile this into some addon or something?
Because I have like no experience at this at all lol
ugh.
go to garrysmod/gamemodes/base/cl_voice.lua and change the PANEL:Paint() function to
[LUA]local VCColors = {}
VCColors["superadmin"] = Color( 255, 100, 100 )
VCColors["admin"] = Color( 200, 100, 100 )
VCColors["moderator"] = Color( 200, 100, 100 )
VCColors["member"] = Color( 100, 255, 100 )
function PANEL:Paint( w, h )
if ( !IsValid( self.ply ) ) then return end
local c = VCColors[self.ply:GetNWString( "usergroup" )]
c = c or Color( 0, self.ply:VoiceVolume() * 200, 0, 240 )
draw.RoundedBox( 4, 0, 0, w, h, Color( c.r, c.g, c.b, 240 ) )
end
[/LUA]
[QUOTE=rejax;42868894]ugh.
go to garrysmod/gamemodes/base/cl_voice.lua and change the PANEL:Paint() function to
[LUA]local VCColors = {}
VCColors["superadmin"] = Color( 255, 100, 100 )
VCColors["admin"] = Color( 200, 100, 100 )
VCColors["moderator"] = Color( 200, 100, 100 )
VCColors["member"] = Color( 100, 255, 100 )
function PANEL:Paint( w, h )
if ( !IsValid( self.ply ) ) then return end
local c = VCColors[self.ply:GetNWString( "usergroup" )]
c = c or Color( 0, self.ply:VoiceVolume() * 200, 0, 240 )
draw.RoundedBox( 4, 0, 0, w, h, Color( c.r, c.g, c.b, 240 ) )
end
[/LUA][/QUOTE]
alright, I did that, is that client sided or serversided? because it says local
anyway sorry for acting odd, i've never actually gotten into LUA before.
[QUOTE='[Maxx];42871422']alright, I did that, is that client sided or serversided? because it says local
anyway sorry for acting odd, i've never actually gotten into LUA before.[/QUOTE]
There are local variables, and global variables, those two have nothing to do with the client or server specifically, you can use them in both places. (And local/global tables etc....)
Local variables just mean they won't be loaded or usable with other functions, or even within it's own function if placed properly.
it worked, thanks! :D
Sorry, you need to Log In to post a reply to this thread.