General: Fix regen issue introduced in 870ef51197

Woops, didnt think about players that have more then the limit, when the
regen would kick in.
This commit is contained in:
zaCade 2018-07-31 23:53:57 +02:00
parent 9676fb9852
commit dc8ea3be56

View File

@ -99,17 +99,19 @@ public Action:ClassHealthRegenTimer(Handle:timer, any:client)
}
new health = GetClientHealth(client);
// Check if the health is below the limit.
if (health < ClientHealthRegenMax[client])
{
// Apply the health regen.
health += ClientHealthRegenAmount[client];
// Clamp the health points to the maximum.
// Clamp the health regen to the limit.
if (health > ClientHealthRegenMax[client])
{
health = ClientHealthRegenMax[client];
}
// Check if the health points is below the limit.
if (health <= ClientHealthRegenMax[client])
{
// Increase health.
SetEntityHealth(client, health);
}