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

[SOLVED] Damage can't increase damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 11-20-2016 , 17:37   [SOLVED] Damage can't increase damage
Reply With Quote #1

I am trying to multiply the damage with each kill but somehow, the damage didn't increase at all
Can Anyone help me with this?
PHP Code:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if (victim == attacker || !is_user_alive(attacker))
        return 
HAM_IGNORED;

    
// Fix bug player not connect
    
if (!is_user_connected(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED;

    
    
// Human attacking zombie...
    
if (!zp_get_user_zombie(attacker) && zp_get_user_zombie(victim))
    {
        
// X Damage
        
new Floatxdmg str_to_float(XDAMAGE[g_level[attacker]])
        
damage *= xdmg

        
new defense zp_class_zombie_get_defense(victim)
        
damage *= defense
        SetHamParamFloat
(4damage)
        return 
HAM_HANDLED
    
}

    return 
HAM_HANDLED;

__________________
My plugin:

Last edited by Celena Luna; 11-21-2016 at 03:26.
Celena Luna is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 11-20-2016 , 19:56   Re: Damage can't increase damage
Reply With Quote #2

Does this forward work without using RegisterHam? Should be something like

Code:
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")

Last edited by pizzahut; 11-20-2016 at 19:57.
pizzahut is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 11-21-2016 , 01:23   Re: Damage can't increase damage
Reply With Quote #3

ouch, I forget to do it @@

EDIT: Still didn't work
__________________
My plugin:

Last edited by Celena Luna; 11-21-2016 at 01:30.
Celena Luna is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 11-21-2016 , 02:23   Re: Damage can't increase damage
Reply With Quote #4

Nevermind, I fixed
PHP Code:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    
// Non-player damage or self damage
    
if(attacker == victim)
        return 
HAM_IGNORED

    
if(!is_user_alive(attacker))
        return 
HAM_IGNORED
    
    
//Zombie attacking Human
    
if(zp_core_is_zombie(attacker) && zp_core_is_last_human(victim))
    {    
        
SetHamParamFloat(4float(get_user_health(victim) * ))
                
        return 
HAM_IGNORED
    
}
    
// Human attacking zombie...
    
else if (!zp_core_is_zombie(attacker) && zp_core_is_zombie(victim))
    {    
        if ((
damage_type DMG_HEGRENADE) && !zp_core_is_zombie(attacker))
        {
            new 
Floatzp_hedmg 500.0 2
            damage 
zp_hedmg
        
}
        else if(
g_level[attacker])
        {
            
// Armor multiplier for the final damage
            
new Floatxdmg str_to_float(XDAMAGE[g_level[attacker]])
            
damage *= xdmg
        
}
        
SetHamParamFloat(4damage)
        return 
HAM_IGNORED;
    }
    
    return 
HAM_IGNORED;

__________________
My plugin:
Celena Luna is offline
pizzahut
Senior Member
Join Date: Oct 2004
Old 11-21-2016 , 05:27   Re: Damage can't increase damage
Reply With Quote #5

Quote:
Originally Posted by Celena Luna View Post
Nevermind, I fixed
PHP Code:
        SetHamParamFloat(4damage)
        return 
HAM_IGNORED;
    }
    
    return 
HAM_IGNORED;

It should be HANDLED after changing damage, and IGNORED otherwise. So like this:

PHP Code:
        SetHamParamFloat(4damage)
        return 
HAM_HANDLED
    
}
    
    return 
HAM_IGNORED

pizzahut is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 11-21-2016 , 06:51   Re: Damage can't increase damage
Reply With Quote #6

Quote:
Originally Posted by pizzahut View Post
It should be HANDLED after changing damage, and IGNORED otherwise. So like this:

PHP Code:
        SetHamParamFloat(4damage)
        return 
HAM_HANDLED
    
}
    
    return 
HAM_IGNORED

That makes no sense.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
pizzahut
Senior Member
Join Date: Oct 2004
Old 11-21-2016 , 08:34   Re: Damage can't increase damage
Reply With Quote #7

Quote:
Originally Posted by PRoSToTeM@ View Post
That makes no sense.
/**
* Ham return types.
*
* @note Return these from hooks to disable calling the target function.
* Numbers match up with fakemeta's FMRES_* for clarity. They are
* interchangable. 0 (or no return) is also interpretted as HAM_IGNORED.
*/
#define HAM_IGNORED 1 /**< Calls target function, returns normal value */
#define HAM_HANDLED 2 /**< Tells the module you did something, still calls target function and returns normal value */
#define HAM_OVERRIDE 3 /**< Still calls the target function, but returns whatever is set with SetHamReturn*() */
#define HAM_SUPERCEDE 4 /**< Block the target call, and use your return value (if applicable) (Set with SetHamReturn*()) */

Last edited by pizzahut; 11-21-2016 at 08:34.
pizzahut is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 11-21-2016 , 12:57   Re: [SOLVED] Damage can't increase damage
Reply With Quote #8

@pizzahut ham module ignores it.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
pizzahut
Senior Member
Join Date: Oct 2004
Old 11-21-2016 , 17:44   Re: [SOLVED] Damage can't increase damage
Reply With Quote #9

I see, never mind then.
pizzahut 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 21:14.


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