View Single Post
Skorpion1976
Veteran Member
Join Date: Jun 2009
Location: Austria
Old 03-21-2010 , 16:46   Re: [L4D2] HP Regeneration V-1.11 (3/21/10)
Reply With Quote #10

I run 8vs8 and activated this plugin for both teams.
SI: every 3 seconds 20 HP, SURV: every 3 seconds 1 HP up to max. 70 HP
But despite the barrier of 70 HP, the survivors gain 1 HP every 3 secs, infinitely. I cannot stop that, it runs over 160 HP... example: my survivors have 150 HP at start. cvarSurvivorHP = 70, meaning, the plugin should heal up survs only to 70, not further, 1 HP every 3 seconds. In line 118 the code does this:
Code:
 if (70 + 1 < (1 + 150)).
If true, add 1 HP. The same "if" statement 3 seconds later:
Code:
if(70 + 1 < (1 + 151))
and so on... you see what I mean? Because of this it does not stop healing.

I replaced the 2 "ifs" by only 1 "if":
Code:
if (sHP < sMaxHP)
{
    SetEntProp(client, Prop_Send, "m_iHealth", sHP + sHPRegen, 1);
}
This should mean: Only if current survivor HP < 70, heal him up. In all other cases it does nothing, as intented.

AND please fix this:
L 03/21/2010 - 217:26: [SM] Native "KillTimer" reported: Invalid timer handle 0 (error 4)
L 03/21/2010 - 217:26: [SM] Displaying call stack trace for plugin "hp_regeneration.smx":
L 03/21/2010 - 217:26: [SM] [0] Line 238, L4D2 HP Regeneration.sp::KillClientTimer()
L 03/21/2010 - 217:26: [SM] [1] Line 228, L4D2 HP Regeneration.sp::OnMapEnd()

Last edited by Skorpion1976; 03-21-2010 at 17:19.
Skorpion1976 is offline