I have seen a server with a image in the hud?
How would i go about making this possible?
I have the image background.png
my hud is in lua/autorun/client/cl_hud.lua
[editline]21st June 2016[/editline]
local mat = Material( "background.png" )
surface.SetMaterial( mat )
surface.DrawTexturedRect(ScrW() / 2 - 625, ScrH() - 145, 120, 120)
[editline]21st June 2016[/editline]
and then i have background.png in materials/background.png
it just show purple texture
Make sure to keep the local mat = Material("background.png") outside of the HUDPaint hook, and place surface.DrawTexturedRect() and surface.SetMaterial() in a HUDPaint hook.
Is it on your client in the materials folder?
No, it doesnt show purple anymore but doesnt show the image too, its just a transparent color.
Heres my addon:
Addons/MyHud/lua/autorun/client/cl_hud.lua
Addons/MyHud/lua/autorun/server/sv_hud.lua
Addons/MyHud/materials/background.png
In cl_hud is this code here:
[lua]local mat = Material( "background.png" )
hook.Add("HUDPaint" , "DrawMyHud" , function()
surface.SetMaterial( mat )
surface.DrawTexturedRect(ScrW() / 2 - 625, ScrH() - 145, 120, 120)
--> Background
-- draw.RoundedBox( 0, ScrW() / 2 - 625, ScrH() - 145, 120, 120, Color(30,50,30,255) ) -- dont worry about this, just incase..
end)[/lua]
And then heres my sv_hud.lua
[lua]resource.AddFile( "background.png" )[/lua]
And in my materials is just the background.png
[editline]22nd June 2016[/editline]
Nevermind, thanks for all the help!
I fixed it by changing local mat to materials/background.png