AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   MoneyMod ( PRIVATE! ) Wont reduce falldmg? (https://forums.alliedmods.net/showthread.php?t=155876)

HBxander 04-27-2011 14:06

MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
My code:
PHP Code:

public FwdPlayerTakeDMG(iPlayerinflictorattackerFloat:damagedamagebits)
{
    
//If player is alive and the damage is done by falling
    
if(is_user_alive(iPlayer) && (damagebits DMG_FALL) )
    {
        
//If player is either ct or T
        
new CsTeams:team cs_get_user_team(iPlayer);
        if( 
team == CS_TEAM_CT || team == CS_TEAM_T 
        {    
            new 
percent ItemMaxValue FALLDMG ] * iLevel_Item iPlayer ] [ FALLDMG ] / ItemMaxLevel FALLDMG ]
            new 
Float:reduction float floatround ( ( damage float percent ) / 100.0 ), floatround_floor ) )
            
            
SetHamParamFloat 4damage reduction 
            
            
set_hudmessage(0127255, -1.0, -1.0)
            
show_hudmessage iPlayer"Fall Damage Reducer - Level %i^nInitial Damage: %.1f^nTaken Damage: %.1f^nDamage Reduced: %.1f"iLevel_Item iPlayer ] [ FALLDMG ], damagedamage reductionreduction )
        }
    }


- Its showing the Hudmessage with all correct stats, but it doesnt remove any damage s:

Nyuszy 04-27-2011 14:44

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
http://wiki.alliedmods.net/HamSandwi...cking_the_Hook

you must add
Code:
return HAM_HANDLED

ConnorMcLeod 04-27-2011 14:52

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
Quote:

Originally Posted by Nyuszy (Post 1459049)
http://wiki.alliedmods.net/HamSandwi...cking_the_Hook

you must add
Code:
return HAM_HANDLED

No you don't really have to.


Show the line where you register the forward.

HBxander 04-27-2011 14:54

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
PHP Code:

RegisterHam Ham_TakeDamage"player""FwdPlayerTakeDMG"


SonicSonedit 04-27-2011 15:05

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
HBxander
If you registered function as post, use HAM_OVERRIDE.

Exolent[jNr] 04-27-2011 15:07

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
Quote:

Originally Posted by SonicSonedit (Post 1459067)
HBxander
If you registered functions as post, use HAM_OVERRIDE.

No, that's not his problem.

Quote:

Originally Posted by HBxander (Post 1459058)
PHP Code:

RegisterHam Ham_TakeDamage"player""FwdPlayerTakeDMG"


Easiest fix is to change that to a pre hook.

HBxander 04-27-2011 15:07

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
E: Changed old RegisterHam to -->

PHP Code:

RegisterHam Ham_TakeDamage"player""FwdPlayerTakeDMG" 


HBxander 04-27-2011 15:16

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
But.. exolent, the problem aint that it doesnt work, it shows the hudmessage, but it just doesnt remove the damage? s:

cant understand why..

Hunter-Digital 04-27-2011 15:22

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
Stupid question: Is "damage reduced:" showing a number above 0 ?

If it is, I dunno... try some returns, like HAM_HANDLED or HAM_OVERRIDE at least to be sure they're not required.

SonicSonedit 04-27-2011 15:25

Re: MoneyMod ( PRIVATE! ) Wont reduce falldmg?
 
Exolent[jNr]
Doesn't HAM_OVERRIDE overrides also params when used in post?

Hunter-Digital
That's not the case. The problem is that he uses a post-function, which are not supposed to change params, since they are already passed.


All times are GMT -4. The time now is 04:31.

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