AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Solved] Reducing Fall damage by percentage not working (https://forums.alliedmods.net/showthread.php?t=229985)

xoxolala 11-17-2013 22:11

[Solved] Reducing Fall damage by percentage not working
 
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




All times are GMT -4. The time now is 23:22.

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