Raised This Month: $ Target: $400
 0% 

Slow Down Damage with Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mlk27
Veteran Member
Join Date: May 2008
Old 05-10-2009 , 05:04   Slow Down Damage with Ham_TakeDamage
Reply With Quote #1

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 }
__________________
HLDSWatch - HLDS monitoring and auto restarter script
Mlk27 is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-10-2009 , 05:16   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #2

Not sure
if (damage_type & DMG_RADIATION)
{
return HAM_SUPERCEDE
}
return HAM_IGNORED
xbatista is offline
Send a message via Skype™ to xbatista
Mlk27
Veteran Member
Join Date: May 2008
Old 05-10-2009 , 05:26   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #3

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
__________________
HLDSWatch - HLDS monitoring and auto restarter script

Last edited by Mlk27; 05-10-2009 at 05:30.
Mlk27 is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-10-2009 , 05:34   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #4

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 is offline
Send a message via Skype™ to xbatista
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 05-10-2009 , 05:47   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #5

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
xbatista is offline
Send a message via Skype™ to xbatista
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-10-2009 , 07:17   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #6

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;

SnoW is offline
Send a message via MSN to SnoW
Mlk27
Veteran Member
Join Date: May 2008
Old 05-10-2009 , 07:42   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #7

I guess that should do it, thanks Snow. By the way, what's the diff return HAM_HANDLED vs HAM_SUPERCEDE?
__________________
HLDSWatch - HLDS monitoring and auto restarter script
Mlk27 is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 05-10-2009 , 07:47   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #8

Quote:
Originally Posted by Mlk27 View Post
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.
SnoW is offline
Send a message via MSN to SnoW
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-10-2009 , 09:46   Re: Slow Down Damage with Ham_TakeDamage
Reply With Quote #9

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.
Arkshine is offline
Reply


Thread Tools
Display Modes

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 01:28.


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