Raised This Month: $51 Target: $400
 12% 

Need suggestion for dealing damage on damage event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 03-07-2016 , 16:32   Need suggestion for dealing damage on damage event
Reply With Quote #1

Hi,
So I use SDKHooks_TakeDamage to deal damage to player, but in player_hurt event. I want to deal it with custom parameters, but not for victim from an event. And the problem is that it has infinite loop.
So I need a suggestion how to avoid this.
Put timer? Use traces to detect hit?
__________________
xbatista is offline
Send a message via Skype™ to xbatista
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 03-07-2016 , 17:41   Re: Need suggestion for dealing damage on damage event
Reply With Quote #2

I think its appropriate to knock up some sample code.
__________________
Neuro Toxin is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 03-07-2016 , 23:28   Re: Need suggestion for dealing damage on damage event
Reply With Quote #3

PHP Code:
public Action Event_PlayerHurt(Handle event, const char[] namebool dontBroadcast)
{
    static 
bool bIgnore false;
    if(
bIgnore)
    {
        
bIgnore false;
        return 
Plugin_Continue;
    }
    
    
bIgnore true;
    
SDKHooks_TakeDamage(...);
    
    return 
Plugin_Handled;

Miu is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 03-08-2016 , 01:08   Re: Need suggestion for dealing damage on damage event
Reply With Quote #4

Looks simple, I was thinking about additional check.
Thanks. It seems that this is easiest way
__________________
xbatista is offline
Send a message via Skype™ to xbatista
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 11:34.


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