Raised This Month: $51 Target: $400
 12% 

[CS:GO] Hook health gain


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 08-08-2015 , 10:44   [CS:GO] Hook health gain
Reply With Quote #1

Hello,

I am currently working on a plugin which shows hp bars above zombie's heads.
So far I have managed to implement a hook for takedamage, but how do I hook if a player gains health (through ZR).

The only possible way I currently see is creating a high-frequency timer (100ms) and tracking a player's health, but that's quite.. wonky.
Anyone got any ideas?
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster is offline
psychonic

BAFFLED
Join Date: May 2008
Old 08-08-2015 , 11:33   Re: [CS:GO] Hook health gain
Reply With Quote #2

Use the DHooks extension to hook TakeHealth or the send-proxy extension to hook changes to m_iHealth.
psychonic is offline
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 08-08-2015 , 12:18   Re: [CS:GO] Hook health gain
Reply With Quote #3

I guess it's this function?
CBasePlayer::TakeHealth(float, int) (guessing that float is the amount of health gained, not sure about the int)
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster is offline
Michalplyoutube
Veteran Member
Join Date: Jan 2013
Location: Tank Carrier in Mannhatt
Old 08-08-2015 , 14:25   Re: [CS:GO] Hook health gain
Reply With Quote #4

I guess timer that loops each client would do

every 0.1s check health and if it differs call somethin
__________________
The plugin developer of TF2BWR Reborn
And a TF2 Player
Michalplyoutube is offline
psychonic

BAFFLED
Join Date: May 2008
Old 08-09-2015 , 00:20   Re: [CS:GO] Hook health gain
Reply With Quote #5

Quote:
Originally Posted by pcmaster View Post
I guess it's this function?
CBasePlayer::TakeHealth(float, int) (guessing that float is the amount of health gained, not sure about the int)
Yes. The int is damage bits (health uses the same "damage" flags).
psychonic is offline
pcmaster
AlliedModders Donor
Join Date: Sep 2009
Old 08-10-2015 , 08:34   Re: [CS:GO] Hook health gain
Reply With Quote #6

Okay, thanks for your help.
While the hook seems to be working, the original plugin around it does not (the hp bars are invisible).
__________________
Stopped hosting servers as of November 2018, no longer active around here.
pcmaster is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode