Raised This Month: $ Target: $400
 0% 

best way to catch changed hp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-24-2009 , 18:24   best way to catch changed hp
Reply With Quote #1

hey,

i want to write a mod for fy_rambohulk http://www.fpsbanana.com/maps/2522 .
so i want to catch the hulk. i tough i can catch the users health in prethink and if is the users health over 1000, is my user the hulk.
but i think its not a good idea to catch it in prethink.
has anyone a idea in which way i can do it better?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 10-24-2009 , 19:02   Re: best way to catch changed hp
Reply With Quote #2

I think you can use client_infochanged(), but I can't remember exactly.
Spunky is offline
Send a message via AIM to Spunky
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 10-24-2009 , 19:18   Re: best way to catch changed hp
Reply With Quote #3

client_infochanged() is not hooked or even executed when a clients health changes. I dont really see a problem using PreThink though. There may be some other way that you could check the clients health for efficiently, but PreThink should do the job.
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 10-24-2009 , 19:21   Re: best way to catch changed hp
Reply With Quote #4

Just check everyone's hp on spawn, and if someone has over 1000 hp, store their index in a global variable.
Jon is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-24-2009 , 19:25   Re: best way to catch changed hp
Reply With Quote #5

ty.

i just tough there are/is better ways to get this.
@ Jon : the problem is that the player has to be in a placer for 10 sec. to get hulk. all users spawn with 100hp. so thats why i cant forward spawns
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-24-2009 , 20:33   Re: best way to catch changed hp
Reply With Quote #6

Try to hook Ham_Blocked or Ham_TakeDamage (DMG_CRUSH)
__________________
Arkshine is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 10-24-2009 , 22:03   Re: best way to catch changed hp
Reply With Quote #7

Easiest way I would think would be to register the Health event from HL...
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-25-2009 , 07:01   Re: best way to catch changed hp
Reply With Quote #8

Quote:
Originally Posted by Arkshine View Post
Try to hook Ham_Blocked or Ham_TakeDamage (DMG_CRUSH)
Quote:
Originally Posted by Emp` View Post
Easiest way I would think would be to register the Health event from HL...
ty @ both. where can i get more info about ham blocked? because i couldnt find anything in wiki or func.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-25-2009 , 07:05   Re: best way to catch changed hp
Reply With Quote #9

ham_const.inc
PHP Code:
        /**
         * Description:                Normally called whenever one entity blocks another from moving.
         * Forward params:        function(this, idother);
         * Return type:                None.
         * Execute params:        ExecuteHam(Ham_Blocked, this, idother);
         */
        
Ham_Blocked
__________________
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-25-2009 , 07:08   Re: best way to catch changed hp
Reply With Quote #10

See the ham_const.inc.

If I say Ham_Blocked is because the health is given from func_door. You have 4 func_door above the area when you jump. And the health is given from CBaseDoor::Blocked().

So doing :

Code:
RegisterHam( Ham_Blocked, "func_door", "CBaseDoor_Blocked", 1 ) // public CBaseDoor_Blocked ( const Door, const Other ) {      // Other is the index of the hulk. I don't check if Other is a not player since I doubt that it will happen. }


Quote:
Easiest way I would think would be to register the Health event from HL...
Not really because you can have another plugins which give you a lot of health. Using Ham_Blocked we can be sure since it will be triggered only then the player will jump.
__________________

Last edited by Arkshine; 10-25-2009 at 07:25.
Arkshine 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 17:33.


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