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

[Solved] Reducing Fall damage by percentage not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xoxolala
Junior Member
Join Date: Nov 2013
Old 11-17-2013 , 22:11   [Solved] Reducing Fall damage by percentage not working
Reply With Quote #1

FIXED!

Hey AM

I want to reduce Fall Damage by a percentage of amount. (IE. 40%, 50%, 60% etc, but depending on a specific level on an upgrade!)
So, I know the calculation is correct, I have tested that! But it doesn't reduce my damage taken.. Is this a mistake in the code? I have this code;
Changed:
PHP Code:
RegisterHam Ham_TakeDamage"player""CmdPlayerTakeDmg"
---->
PHP Code:
RegisterHam Ham_TakeDamage"player""CmdPlayerTakeDmg"
so it will use my cmd before the player takes dmg, instead of after
PHP Code:
public CmdPlayerTakeDmg idinflictorattackerFloat:damagedamagebits )
{
    new 
iFallCT gUserLevelCT id ] [ FALLDMGREDUCER ] * gItemAmountCT FALLDMGREDUCER ]
    new 
iFallT gUserLevelT id ] [ FALLDMGREDUCER ] * gItemAmountT FALLDMGREDUCER ]
    
    if ( 
is_user_alive id ) && ( damagebits DMG_FALL ) )
    {
        if ( 
cs_get_user_team id ) == CS_TEAM_T )
        {
            
SetHamParamFloat 4damage * ( 1.0 - ( float iFallT ) / 100.0 ) ) )
        }
        else if ( 
cs_get_user_team id ) == CS_TEAM_CT )
        {
            
SetHamParamFloat 4damage * ( 1.0 - ( float iFallCT ) / 100.0 ) ) )
        }
    }
    if ( 
cs_get_user_team id ) == CS_TEAM_T )
    {
        if ( 
gUserLevelT id ] [ NOPAIN ] )
        {
            
set_pdata_float id1081.0 )
        }
    }
    else if ( 
cs_get_user_team id ) == CS_TEAM_CT )
    {
        if ( 
gUserLevelCT id ] [ NOPAIN ] )
        {
            
set_pdata_float id1081.0 )
        }
    }
    return 
HAM_HANDLED


Last edited by xoxolala; 11-17-2013 at 22:15.
xoxolala 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:26.


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