General > Developers Corner

Help With HUDDrawTargetID?

(1/1)

iViscosity:
You know in some gamemodes like TTT how if you look at someone it can show you information about them like if they have 90 or higher health it'll say "Healthy" or something like that when you look at them? How can I access that? I'm writing an Experience mod that I want to display some information under this stuff, but I'm not sure how to get it.


Is it gamemode specific, like will I have to look through the TTT code or any other gamemode that supports it, or can I find it on the wiki somewhere?


Edit: Think I found it... GM:HUDDrawTargetID except I'm not sure how I could draw it to position correctly. I want it to display the amount of experience they currently have / the experience they need to level up and the value of the Level they're at (I have functions for these, I just need to know how to position them).


The description says


"Called from GM:HUDPaint to draw player info when you hover over a player with your crosshair or mouse."


So how do I mix these together? Never really used HUD Painting before, not sure how to use this  :'(

MrPresident:
Take a look at

garrysmod/gamemodes/base/gamemode/cl_targetid.lua

This is how garrysmod handles HUDDrawTargetID()

You don't need to mix it with HUDPaint, it's just saying that it's called from within HUDPaint. you essentially just draw elements in that function.

It is entirely clientside, so any information about a player you want to draw will need to be networked or saved to NWVars.

iViscosity:
Ah that seems fairly easy to understand... I'll take a look and see what I can do, thanks.

iViscosity:
Quick question, if I added this hook, would it be automatically positioned or would I have to position it? I'd like it to be centred under the current things that are there, do I need to position it manually?


EDIT: Just realized I'd have to position it myself... derp


Will see if I can figure it out.

MrPresident:
It's not that hard. That's why I suggested you look at how it's currently done for how they do it.

Navigation

[0] Message Index

Go to full version