Pivity

HUD HELP : adding materials

Last read Never
#1

Since I'm new to glua, I'm creating my own hud. I want to do so when u are wanted a gun icon will show up. although i have no idea how to add it into my server. Any help would be appreciated.

#2

put the .png in the materials folder

in a server-side file do resource.AddFile("materials/path_to_file")

then client-side do local material = Material("path_to_file") do not include materials/ here as it's relative to the materials folder

in a paint hook use

surface.SetMaterial(material)
surface.SetDrawColor(255, 255, 255)
surface.DrawTexturedRect(x, y, w, h)
Agree x 2
#4

you would put the materials folder outside the lua folder so your file structure would look like

-addons

-addon_name

-lua

-autorun

-materials

#5

Isn't it how I have it ?

https://gyazo.com/fb609e389f7a609ba624f7cccc1bc30d


C:\Users\ZorexD\Desktop\XServers\garrysmod\addons\zhud\lua\materials

#6

No, if you read what Zeo said materials needs to be outside of the lua folder and in the path you sent the materials is inside the lua folder. If you are going to ask for help you might want to actually read what the people trying to help you said.

If you are still confused read this page: https://wiki.garrysmod.com/page/Workshop_Addon_Creation

#8

Whats your screen resolution?

#9

did u hook it to hudpaint or

#10

Is that last image your full code, if so it will not work as it is not in a hook like Fluffy said. If you are not currently using a hook you should be using something like this: https://wiki.garrysmod.com/page/GM/HUDPaint

#12

If the image is pink and black that means the texture is missing so either the path to the material is an issue or something else relating to telling the game about the material.

Users viewing this thread
Nobody