Hi, I currently want to add a click sound to my DColumnSheet buttons on the side. Is there any way to do this? Putting a DoClick with just a surface.PlaySound made it work but didnt show any panels when I clicked them.
local function sideButtonPaint(self,w,h)
surface.SetDrawColor(Color(100,60,90,200))
surface.DrawRect(0,0,w,h)
surface.SetDrawColor(50,0,50,255)
surface.SetMaterial(Material("gui/gradient_down"))
surface.DrawTexturedRect(0,0,w,h/2)
if self:IsHovered() then
surface.SetDrawColor(Color(255,150,190,255))
else
surface.SetDrawColor(Color(100,100,100,255))
end
surface.DrawOutlinedRect(0,0,w,h)
self:SetTextColor(Color(255,255,255,255))
self.OnCursorEntered = function()
surface.PlaySound("garrysmod/ui_return.wav")
end
end
for k,v in pairs(tabs.Items) do
v.Button.Paint = sideButtonPaint
end
Do not override functions in your Paint hook.
As for the actual question, call the original function if you are overriding a hook used by the panel.
How do I call the original function?
Sorry, you need to Log In to post a reply to this thread.