Raised This Month: $ Target: $400
 0% 

detect bomb damage in Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 12-26-2008 , 22:23   detect bomb damage in Ham_TakeDamage
Reply With Quote #1

im using Ham_TakeDamage to detect damage but for some reason bomb explosion wont damage T's i was wondering how i can make it detect if the damage is from the bomb and if so then skip the below functions and damage the player regulary
whosyourdaddy is offline
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 01-28-2009 , 14:28   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #2

bump
whosyourdaddy is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-28-2009 , 14:44   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #3

Making new code to fix an other code isn't really effective. I would prefer posting your plugin here and then we could find out what's causing the problem and fix it. Ofc if you have some reason why you don't want to do it, but can't see any.
SnoW is offline
Send a message via MSN to SnoW
whosyourdaddy
Senior Member
Join Date: Apr 2008
Old 01-28-2009 , 15:20   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #4

i think i found the fix for my issue. i had
Code:
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) && !get_pcvar_num( CVAR_mp_friendlyfire ))
     return HAM_SUPERCEDE;
instead of
Code:
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) && !get_pcvar_num( CVAR_mp_friendlyfire ))
     return HAM_IGNORED;

whosyourdaddy is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-29-2009 , 09:00   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #5

Quote:
Originally Posted by whosyourdaddy View Post
i think i found the fix for my issue. i had
Code:
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) && !get_pcvar_num( CVAR_mp_friendlyfire ))
    return HAM_SUPERCEDE;
instead of
Code:
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) && !get_pcvar_num( CVAR_mp_friendlyfire ))
    return HAM_IGNORED;
And still it should be:
Code:
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) || !get_pcvar_num( CVAR_mp_friendlyfire ))
    return HAM_IGNORED;
SnoW is offline
Send a message via MSN to SnoW
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-29-2009 , 18:00   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #6

Quote:
Originally Posted by SnoW View Post
And still it should be:
Code:
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) || !get_pcvar_num( CVAR_mp_friendlyfire ))
    return HAM_IGNORED;
Wrong.
His code will work as:

If players are not on same team, continue.
If players are on the same team and mp_friendlyfire is enabled, continue.
If players are on the same team and mp_friendlyfire is disabled, stop.

Your code will work as:

If players are not on the same team, stop.
If players are on the same team and mp_friendlyfire is enabled, stop.
If players are on the same team and mp_friendlyfire is disabled, continue.

It's simple logic.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 01-30-2009 , 09:58   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #7

Quote:
Originally Posted by Exolent[jNr] View Post
Wrong...
...It's simple logic.
Ofc it's the simplest logic ever, still I were just assuming that it was on/off cvar. Anyway now when I know better that it was mp_friendlyfire, can't still be sure how the plugin should act anyway. Maybe I should still stop commenting codes what I haven't seen.

Last edited by SnoW; 01-30-2009 at 13:04.
SnoW is offline
Send a message via MSN to SnoW
Owyn
Veteran Member
Join Date: Nov 2007
Old 03-12-2009 , 16:16   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #8

how do you detect that damage is by C4 explosion in Ham_TakeDamage ?

im tring to block bomb damage and killing but no luck atm )= looking forward for a little help
Owyn is offline
Send a message via ICQ to Owyn
portocala
Member
Join Date: Jun 2010
Old 09-03-2010 , 13:13   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #9

Personally I found a method:

PHP Code:
new is_bomb 0;

public 
plugin_init ()
{
    
register_plugin (PLUGINVERSIONAUTHOR);
    
register_event("23""event_bomb""a""1=17""6=-105""7=17")
    
RegisterHam (Ham_TakeDamage"player""fwEventTakeDmg");
}

public 
event_bomb()
{
    
is_bomb 1;
    
set_task(0.1"not_bomb");
}

public 
not_bomb()
{
    
is_bomb 0;
}

public 
fwEventTakeDmg (i_Victimi_Inflictori_AttackerFloat:Damagei_DamageBits)
{
    if(
is_bomb)
    {
        
//
    
}

I calculated the time interval between bomb explode and ham_takedamage (in float) and these too are happening in (almost) the same time. So, the 0.1 time for set_task is just perfect.

It's just an opinion... What do you think ?
portocala is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-03-2010 , 13:53   Re: detect bomb damage in Ham_TakeDamage
Reply With Quote #10

http://forums.alliedmods.net/showthread.php?t=87614
__________________
Bugsy 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 09:05.


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