I am creating a HUD for my server that I play with friends on, and i am trying to show the Player’s Avatar in the bottom left corner.
This is how it looks:
The problem comes when trying to change it. I have a ConVar to disable the HUD, but the Avatar stays when i change it.
It also still shows it when i hold the Camera SWEP
Here is the actual function that creates it (Cutting out un-related code):
function DrawHealth() if ONEUSE == 0 then -- So it doesn't create shit tons of avatars local Avatar = vgui.Create( "AvatarImage") Avatar:SetSize( 64, 64 ) Avatar:SetPos( 15, ScrH() - 80 ) Avatar:SetPlayer( LocalPlayer(), 64) Avatar:ParentToHUD() ONEUSE = 1 end end
And it is called in here:
hook.Add( "HUDPaint", "customhud_drawhud", function() -- Create the function that will call our drawing functions to draw the HUD. if GetConVar( "customhud_enabled" ):GetBool() then -- Only if we want it on DrawHealth() DrawAmmo() end end )