Scaling players damage.

Okay so I have a huge problem and its aggravating me… Probably something stupid and easy but I cant seem to figure the SOAB out. So you see here I have the PlayerScaleDamage function which is called when a player takes damage by default of the function. So it scales the damage the player takes based on which limb they are hit in. Well in my code I have all areas set to 0.50 which is half the damage received. Well all of the areas give different damages. they should all be the same. What am I doing wrong?



 	 	function ScaleDamage(ply, hitgroup, dmginfo)

    if (hitgroup == HITGROUP_HEAD) then
 
        dmginfo:ScaleDamage(0.50)
 
    end
    
    if (hitgroup == HITGROUP_CHEST) then
    
        dmginfo:ScaleDamage(0.50)
        
    end
    
    if (hitgroup == HITGROUP_LEFTARM ||
        hitgroup == HITGROUP_RIGHTARM) then
 
        dmginfo:ScaleDamage(0.50)
 
    end

    if (hitgroup == HITGROUP_LEFTLEG ||
        hitgroup == HITGROUP_RIGHTLEG) then
         
        dmginfo:ScaleDamage(0.50)
        ply:SetWalkSpeed(125)
        ply:SetRunSpeed(250)
        
        timer.Simple(2.25, function()
        ply:SetWalkSpeed(250)
        ply:SetRunSpeed(500)
        
    end)
end
end
 
hook.Add("ScalePlayerDamage","ScaleDamage",ScaleDamage)

 	 


uh, the base gamemode function scales damage, I think. I KNOW Fretta does it.

Override the function.

How would I override it?

AFAIK The damage for the head is different than the damage for the torso and so on.

Are you scripting a gamemode? If so, instead of hooking into the function, just make a function called GM:ScalePlayerDamage( ply, hitgroup, dmginfo ) and put your code in there. That stops your gamemode from inheriting the function from its base.