AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Slow Down Damage with Ham_TakeDamage (https://forums.alliedmods.net/showthread.php?t=92104)

Mlk27 05-10-2009 05:04

Slow Down Damage with Ham_TakeDamage
 
I'm trying to slow down damage players would get when they in toxic water to 20 secs or so before they die. This is what I could come up but it completely block the damage lol.

Code:
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type) {     if (!(damage_type & DMG_RADIATION))         return HAM_IGNORED     return HAM_SUPERCEDE }

xbatista 05-10-2009 05:16

Re: Slow Down Damage with Ham_TakeDamage
 
Not sure :)
if (damage_type & DMG_RADIATION)
{
return HAM_SUPERCEDE
}
return HAM_IGNORED

Mlk27 05-10-2009 05:26

Re: Slow Down Damage with Ham_TakeDamage
 
Afaik both codes have the same effect, they completely block radiation damage, instead of slowing down the damage. I looked at source in other scripts, some of them are using SetHamParamFloat to set custom damage amount but im not sure about right usage of it

xbatista 05-10-2009 05:34

Re: Slow Down Damage with Ham_TakeDamage
 
Maybe try to block toxic damage and do new one? With ExecuteHamB(Ham_TakeDamage, victim ,inflictor, attacker, damage_type), search about that , don't remember this function now :}

xbatista 05-10-2009 05:47

Re: Slow Down Damage with Ham_TakeDamage
 
You edited your post :0 okey now I understand and I know how to do it ;) When I'll back home will give you a code

SnoW 05-10-2009 07:17

Re: Slow Down Damage with Ham_TakeDamage
 
PHP Code:

#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
  
RegisterHam(Ham_TakeDamage"player""Ham_damage");
}
public 
Ham_damage(idinflictorattackerFloat:damagedamagebits)
{
  if(
damagebits DMG_RADIATION)
  {
    
SetHamParamFloat(4damage 2.0); //2x less damage
    
return HAM_HANDLED;
  }
  return 
HAM_IGNORED;



Mlk27 05-10-2009 07:42

Re: Slow Down Damage with Ham_TakeDamage
 
I guess that should do it, thanks Snow. By the way, what's the diff return HAM_HANDLED vs HAM_SUPERCEDE?

SnoW 05-10-2009 07:47

Re: Slow Down Damage with Ham_TakeDamage
 
Quote:

Originally Posted by Mlk27 (Post 824826)
I guess that should do it, thanks Snow. By the way, what's the diff return HAM_HANDLED vs HAM_SUPERCEDE?

Quote:

HAM_IGNORED - Nothing happened, the call continues.
HAM_HANDLED - You did something, but the call continues.
HAM_OVERRIDE - The call will still be executed, but instead you will change the return value.
HAM_SUPERCEDE - The call is not executed, and you use your return value, if applicable.
So supercede blocks it, handled just sends that something was done.

Arkshine 05-10-2009 09:46

Re: Slow Down Damage with Ham_TakeDamage
 
Those values are harcoded :

Code:

#define RADIATION_DURATION        2
#define RADIATION_DAMAGE        1.0

To increase the time, maybe using m_rgbTimeBasedDamage[itbd_Radiation] offset could do the trick.


All times are GMT -4. The time now is 01:28.

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