Friend Health System

I was trying to make a client side lua for my game mode. It tells you the HP of you’re friends on the top left of you’re screen.

This code, works:
[lua] for k,v in pairs (player.GetAll()) do if v:Nick()==“Friend Example One” then LocalPlayer():ChatPrint(v:Nick()…": "…v:Health() ) end

It doesn’t work correctly if you try to put in a text draw though.


for k,v in pairs (player.GetAll()) do if v:Nick()==“Friend Example 2” then
draw.DrawText(v:Nick()…": “…v:Health()…”
", examplefont, 2,2, Color(255, 0, 0, 255),TEXT_ALIGN_LEFT) end


It just shows all the people on one line instead of a new line like what chatprint does. I don’t know of any other way you could do this. And this doesn’t even work >.> lol.

edit: Almost forgot. Yes, the drawtext is in the right hook. It isn’t just randomly lying around in some client side lua file.

[lua]draw.DrawText(v:Nick()…": “…v:Health()…”
", examplefont, 2,2 + (k * 20), Color(255, 0, 0, 255),TEXT_ALIGN_LEFT) end[/lua]

Thanks. I’ll test that out in a sec. Btw. when you see
[lua] for k,v in pairs [/lua] v is, well the entity right?
Then what is k?

edit: Yay. It works but you put waayyy too much on the multiplier. Lawl

It’s key, value and you can’t do
in draw but you need to get the amount of players and calculate from that the height.

I see. Thanks.