From dc8ea3be56da1c25632d43887e78a5c88a9de7d1 Mon Sep 17 00:00:00 2001 From: zaCade Date: Tue, 31 Jul 2018 23:53:57 +0200 Subject: [PATCH] General: Fix regen issue introduced in `870ef51197` Woops, didnt think about players that have more then the limit, when the regen would kick in. --- src/zr/playerclasses/healthregen.inc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/zr/playerclasses/healthregen.inc b/src/zr/playerclasses/healthregen.inc index b3afa62..3bdfa89 100644 --- a/src/zr/playerclasses/healthregen.inc +++ b/src/zr/playerclasses/healthregen.inc @@ -99,17 +99,19 @@ public Action:ClassHealthRegenTimer(Handle:timer, any:client) } new health = GetClientHealth(client); - health += ClientHealthRegenAmount[client]; - // Clamp the health points to the maximum. - if (health > ClientHealthRegenMax[client]) + // Check if the health is below the limit. + if (health < ClientHealthRegenMax[client]) { - health = ClientHealthRegenMax[client]; - } + // Apply the health regen. + health += ClientHealthRegenAmount[client]; + + // 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); }