AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_TakeDamage doesn't work (https://forums.alliedmods.net/showthread.php?t=184072)

Enomine 04-30-2012 14:18

Ham_TakeDamage doesn't work
 
I just want to make a no-kill server.
Code...
PHP Code:


//Init
    
RegisterHam(Ham_TakeDamage"player""HamTakeDamage"1);

public 
HamTakeDamage(thisidinflictoridattackerFloat:damagedamagebits)
{
    
SetHamParamFloat(40.0);
    return 
HAM_SUPERCEDE;



kiki33hun 04-30-2012 14:19

Re: Ham_TakeDamage doesn't work
 
Chech is user alive(atacker)

Enomine 04-30-2012 14:26

Re: Ham_TakeDamage doesn't work
 
Not working u,u

Napoleon_be 04-30-2012 14:28

Re: Ham_TakeDamage doesn't work
 
SetHamParamFloat(damage, 0.0) i guess.

hleV 04-30-2012 14:34

Re: Ham_TakeDamage doesn't work
 
You're hooking it as post.

Enomine 04-30-2012 15:06

Re: Ham_TakeDamage doesn't work
 
Thank you, works now.
Can you explain to me what is the diference to post 1 or 0.

Thanks.

Exolent[jNr] 04-30-2012 15:49

Re: Ham_TakeDamage doesn't work
 
If you don't set post (use 0, hooking as pre), then it is before the event is fired.
If you do set post (use 1), then it is after the event is fired.

In this case, hooking post would be after damage is done, so you can no longer modify the damage value.
Hooking as pre will allow you to hook before damage is done so you can modify the values.

Enomine 04-30-2012 15:58

Re: Ham_TakeDamage doesn't work
 
Quote:

Originally Posted by Exolent[jNr] (Post 1699458)
If you don't set post (use 0, hooking as pre), then it is before the event is fired.
If you do set post (use 1), then it is after the event is fired.

In this case, hooking post would be after damage is done, so you can no longer modify the damage value.
Hooking as pre will allow you to hook before damage is done so you can modify the values.

Thanks!

Devil259 04-30-2012 16:11

Re: Ham_TakeDamage doesn't work
 
Also, you can just return HAM_SUPERCEDE instead of set damage to 0 then return.

This code won't remove the blood, if you want to remove the blood (you said no-kill server), hook Ham_TraceAttack instead.

Enomine 05-07-2012 08:36

Re: Ham_TakeDamage doesn't work
 
Quote:

Originally Posted by Devil259 (Post 1699476)
Also, you can just return HAM_SUPERCEDE instead of set damage to 0 then return.

This code won't remove the blood, if you want to remove the blood (you said no-kill server), hook Ham_TraceAttack instead.

I've Hooked PostThink like a post, then when players shoots bullets doesn't hit the body :D

(Sorry for my bad english ^_^)

Thanks!


All times are GMT -4. The time now is 07:43.

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