I am working in a lua file in “common\GarrysMod\garrysmod\lua” and i am trying to use surface.DrawTexturedRect but to do so i need to create a material. I have the material i need which is a png file but where do i put the png file and what code do i need to do in order to make it a material.
First of all, your code wont run as it’s inside of garrysmod/lua, it should be on Autorun to be able to get ran, but, you SHOULD put the Lua files inside of an addon instead, as its more organized and you won’t mix game files with addon files.
Now, for the materials, all materials shall go into the material folder (i’d recommend putting it inside of the same addon as well).
Now, if you want to paint that texture on the HUD you should use the
Now, as you’re using this hook, before actually painting the material you may want to use
surface.SetDrawColor, as this may be used before your addon and then your addon may get strange colors from other addons.