Hello, so I have an icon that when it sees your wanted it will show up and when your not wanted it dims the icon opacity (code below) and when I use it it works without issues but it appears under a rounded box... How would I fix this?
local Page = Material("icon16/page_white_text.png")
local function GunLicense()
if localplayer:getDarkRPVar("HasGunlicense") then
surface.SetMaterial(Page)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(300, ScrH() - 100, 20, 20)
else
surface.SetMaterial(Page)
surface.SetDrawColor(255, 255, 255, 70)
surface.DrawTexturedRect(300, ScrH() - 100, 20, 20)
end
end
Did you made code that draws that box?
This is the box that its showing up under if thats what you mean
draw.RoundedBox(6, ScrW()*(10/1920), ScrW()*(995/1920), ScrW()*(450/1920), ScrW()*(70/1920), Color(46, 46, 52, 255))
Draw the gunlicense below the roundedbox.
draw.RoundedBox(6, ScrW()*(10/1920), ScrW()*(995/1920), ScrW()*(450/1920), ScrW()*(70/1920), Color(46, 46, 52, 255))
GunLicense()
https://www.youtube.com/watch?v=87t8jtuqIbI
That is a similar thing to this. Draw the icon AFTER the box and it will be on top.
Thats what im doing but it still shows up under...
just show us the whole code..that littke piece of the function clearly isnt helping
Heres where I draw GunLicense() I draw it at the very end of my code
function DrawHUD()
localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
if not IsValid(localplayer) then return end
-- Default
GunLicense()
Agenda()
-- DrawVoiceChat()
LockDown()
Arrested()
AdminTell()
DrawEntityDisplay()
end
hook.Add("HUDPaint", "DrawHUD", DrawHUD)
Heres where I add the icon when they are Licensed at about the middle of the code
local Page = Material("icon16/page_white_text.png")
local function GunLicense()
if localplayer:getDarkRPVar("HasGunlicense") then
surface.SetMaterial(Page)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRect(ScrW()*(250/1920), ScrW()*(980/1920), 20, 20)
else
surface.SetMaterial(Page)
surface.SetDrawColor(255, 255, 255, 70)
surface.DrawTexturedRect(ScrW()*(250/1920), ScrW()*(980/1920), 20, 20)
end
end
and heres where I add the box about at the beginning of the code
draw.RoundedBox(6, ScrW()*(10/1920), ScrW()*(995/1920), ScrW()*(450/1920), ScrW()*(70/1920), Color(46, 46, 52, 255))
Making it ordered does nothing for some reason.
The draw.RoundedBox also needs to be inside one of the functions or the paint hook.
Draw.RoundedBox needs to be in said DrawHUD function.
That seemed to fix my issue! Thanks for all the help guys.
Sorry, you need to Log In to post a reply to this thread.