Solvedchanging surface.SetDrawColour with mixer

Posts 1–5 of 5 · Page 1 of 1
changing surface.SetDrawColour with mixer
I'm having trouble changing the colour of a drawn crosshair using a color mixer.
This is the mixer
Code:
local CMixer = vgui.Create( "DColorMixer", panel3)
CMixer:Dock( 50, 20, 0, 0 )
CMixer:SetPalette( true )         
CMixer:SetAlphaBar( true )         
CMixer:SetColor( color_white )
local cross = CMixer:GetColor()
This is the crosshair
Code:
function crosshair()
surface.SetDrawColor(cross)
surface.DrawLine(670, 384, 680, 384)
surface.DrawLine(688, 384, 698, 384)
surface.DrawLine(684, 388, 684, 398)
surface.DrawLine(684, 380, 684, 370)
end
hook.Add("HUDPaint", "crosshair", crosshair)
Whenever I choose a color on the mixer, then press a button I've made that does the following when clicked it doesn't change the color of the drawn crosshair
Code:
crosschange.DoClick = function()
surface.SetDrawColor(cross)
end
What am I doing wrong?
im not familiar with with the colormixer but i think you have to do
Code:
surface.SetDrawColor(CMixer:GetColor())
Tried that aswell, it works fine while the menu is open, but whenever I close the menu it hits me with "attempt to call method 'GetColor' (a nil value)" because it can't get the color that the mixer chose if the menu isn't open.
/Thread. solved it
Glad to know that.

/Closed.
Posts 1–5 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us