So I'm a beginner with all of this. After gathering some information from experienced script makers and a few server owners, I decided to start small and make a HUD.
It's a very basic HUD and I want to first of all get the most basic things down like hp, armor etc. which I've managed to do following the gmod wiki, youtube tutorials and a few helping words from others.
This problem has been my biggest so far and that is custom hud images. So far I placed basic silkicons as my hp/armor etc. but I want to do custom ones, yet I didn't know how. I have a basic dedicated server that I can join running and it has darkrp on it. I've managed to also get my hud to work on it.
So this is what I got:
I placed an addon on the workshop which contains this: (folder) materials0/*.png * - All the picture names such as hud_health.png, hud_armor.png etc.
Then I went in to my script folder and made the same idea so I have: HUD/materials/materials0/*.png
Onwards from that I have this line of code to set my materials location in to a simpler value:
local HUDHHH = Material("materials0/solid_health.png")
That's at the top of my script.
Then later under that I have:
local function CreateImageIcon( icon, x, y, col, val ) -- Icon Function
surface.SetDrawColor( col )
surface.SetMaterial( icon )
local w, h = 20, 20
if val then
surface.SetDrawColor( Color( 255, 255, 255 ) )
end
surface.DrawTexturedRect( x, y, w, h )
end
So that makes it easier to make all the icons.
Then at the bottom of my HUDPaint I have this:
CreateImageIcon(HUDHHH,190,ScrH()-130,Color(255,255,255))
That is the one that actually places it on my screen, chooses location, etc.
The problem is, the damn icon is untextured or whatever and has the purple/black squares. I have no damn clue on how to fix it.
Material("materials0/solid_health.png")
Did you mean this materials0?
The path here is effectively materials/materials0/solid_health.png
Didn't make a difference, but I just realised something else.
In the addon I uploaded it was: materials0/materials/*.png
In my server files I have materials/materials0/*.png
And in my materials calls now I have materials/materials0/*.png
Can it be because I fckd the order for the addon that it's not working?
Okay, after going through all of the troubles I just managed to fix it.
Turns out the addon that I uploaded had to follow exactly like the files in my server addons:
SOLID/materials/materials0/*.png
Once both places matched, I just had to refrence it from the files and that's it.
Sorry, you need to Log In to post a reply to this thread.