Hey guys I am coding some HUD for my gamemode but I got stuck with the silkicons. (First time using them.)
Can someone fix this code for me?
[code]function hpbar()
local health = LocalPlayer():Health()
draw.RoundedBox(0, 5, ScrH() - 25 - 40, health, 15, Color(255,0,0,230))
draw.SimpleText(health, "ScoreboardText", 14, ScrH() - 25 - 40, Color(0, 0, 0, 255))
draw.TexturedQuad( ( "gui/silkicons/heart", Color( 255, 255, 255, 255 ), 27, ScrH() - 25, 43, 16 ) )
end[/code]
Are you hooking it to hudpaint?
Yea.
Are you getting any errors in console?
He's trying to use TexturedQuad with a single argument, and he's using a string as the material.
[QUOTE=King Flawless;29095585]Are you getting any errors in console?[/QUOTE]
[gamemodes\notoriousdm\gamemode\cl_hud.lua:11] ')' expected near ','
Read the example on the wiki
[b][url=http://wiki.garrysmod.com/?title=Draw.TexturedQuad]Draw.TexturedQuad [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Grr... Could you fix the code please? (Sorry. I'm a nub to lua compared to most of you guys...)
[QUOTE=z3r0killz;29096041]Grr... Could you fix the code please? (Sorry. I'm a nub to lua compared to most of you guys...)[/QUOTE]
Just some advice - you're never going to get better and coding and not need help if you don't try to fix it yourself.
You can't rely on others do do everything for you all the time.
[QUOTE=Feihc;29097078]Just some advice - you're never going to get better and coding and not need help if you don't try to fix it yourself.
You can't rely on others do do everything for you all the time.[/QUOTE]
Sorry but I tried.
[QUOTE=z3r0killz;29097094]Sorry but I tried.[/QUOTE]
Then keep trying, don't give up.
Read your errors, they tell you what's going on.
Look at the line number it says, what it's saying is missing/incorrect and think about what in that function call or what have you is going wrong.
If you can figure out how to problem solve your way through things it will benefit you not only in coding for GMod but for life as a hole.
I know personally I have used skills from debugging my code in GMod to a ton of other projects that I've worked on.
I was on my high schools robotics team as the lead programmer and a lot of times I would think back to when I was coding Lua to solve problems that I had with our robot.
Alright... I'll keep trying but every time I fix the error another one comes.
[QUOTE=z3r0killz;29097228]Alright... I'll keep trying but every time I fix the error another one comes.[/QUOTE]
Welcome to the glorious world of programming, my friend.
It happens to all of us, it's the process of creating and coding.
Fixed it. :D
Sorry, you need to Log In to post a reply to this thread.