AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   best way to catch changed hp (https://forums.alliedmods.net/showthread.php?t=107269)

One 10-24-2009 18:24

best way to catch changed hp
 
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?

Spunky 10-24-2009 19:02

Re: best way to catch changed hp
 
I think you can use client_infochanged(), but I can't remember exactly.

Xellath 10-24-2009 19:18

Re: best way to catch changed hp
 
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.

Jon 10-24-2009 19:21

Re: best way to catch changed hp
 
Just check everyone's hp on spawn, and if someone has over 1000 hp, store their index in a global variable.

One 10-24-2009 19:25

Re: best way to catch changed hp
 
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 :D

Arkshine 10-24-2009 20:33

Re: best way to catch changed hp
 
Try to hook Ham_Blocked or Ham_TakeDamage (DMG_CRUSH)

Emp` 10-24-2009 22:03

Re: best way to catch changed hp
 
Easiest way I would think would be to register the Health event from HL...

One 10-25-2009 07:01

Re: best way to catch changed hp
 
Quote:

Originally Posted by Arkshine (Post 971287)
Try to hook Ham_Blocked or Ham_TakeDamage (DMG_CRUSH)

Quote:

Originally Posted by Emp` (Post 971363)
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.

hleV 10-25-2009 07:05

Re: best way to catch changed hp
 
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


Arkshine 10-25-2009 07:08

Re: best way to catch changed hp
 
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.


All times are GMT -4. The time now is 17:33.

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