ULX

Author Topic: Help With HUDDrawTargetID?  (Read 2601 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Help With HUDDrawTargetID?
« on: January 12, 2017, 07:53:38 PM »
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  :'(
« Last Edit: January 12, 2017, 08:07:34 PM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help With HUDDrawTargetID?
« Reply #1 on: January 12, 2017, 08:55:46 PM »
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.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Help With HUDDrawTargetID?
« Reply #2 on: January 12, 2017, 09:05:43 PM »
Ah that seems fairly easy to understand... I'll take a look and see what I can do, thanks.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Help With HUDDrawTargetID?
« Reply #3 on: January 13, 2017, 01:00:08 PM »
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.
« Last Edit: January 13, 2017, 01:05:45 PM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Help With HUDDrawTargetID?
« Reply #4 on: January 13, 2017, 05:33:06 PM »
It's not that hard. That's why I suggested you look at how it's currently done for how they do it.