Hey trying to figure out a way for players to chose a color for their crosshair using DColorMixer
How can I make the selected color a player selects in the mixer be the color for the players crosshair?
local frame = vgui.Create( "DFrame" )
frame:SetSize( 267, 186 ) --good size for example
frame:Center()
frame:MakePopup()
local Mixer = vgui.Create( "DColorMixer", frame )
Mixer:Dock( FILL ) --Make Mixer fill place of Frame
Mixer:SetPalette( true ) --Show/hide the palette DEF:true
Mixer:SetAlphaBar( true ) --Show/hide the alpha bar DEF:true
Mixer:SetWangs( true ) --Show/hide the R G B A indicators DEF:true
Mixer:SetColor( Color( 30, 100, 160 ) ) --Set the default color
hook.Add("HUDPaint", "DrawMyHud", function()
local CrossHair = {}
if CrossHair then
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawRect(ScrW()/2, ScrH()/2 - 3, 1, 7)
surface.DrawRect(ScrW()/2 - 3, ScrH()/2, 7, 1)
end
end)
local function HideThings( name )
if(name == "CHudCrosshair") then
return false
end
-- We don't return anything here otherwise it will overwrite all other
-- HUDShouldDraw hooks.
end
hook.Add( "HUDShouldDraw", "HideThings", HideThings )