The problem seems to be that the player actually takes the damage after the event, which is why we need to modify the damage. There must be a way, but it's not easy to know without documented function reference
Code:
function player_ondamage( player, damageinfo )
player:AddHealth( damageinfo:GetDamage() )
end
With that I stay constantly at ~17 health when taking damage. Also it doesn't add armor back, and I have no idea how to detect how much armor was lost.
edit: could someone tell me how to create a variable of type "custom [float]"?
edit: Alright. If I do "SetDamage(0.0)" that "0.0" is actually considered as a "number" type variable which have precision of two decimals, but the precision of the damage is 12 decimals. How can I create a float that has precision of 12 decimals?