From 0a8f421ca077f797bf8d70d189d7cbab5fe88232 Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Wed, 8 Jan 2025 16:42:18 +0300 Subject: [PATCH] Fix max health formula --- Client/mods/deathmatch/logic/CClientPed.cpp | 6 ++---- Server/mods/deathmatch/logic/CPed.cpp | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 30554d60b6..80e2ed1e8f 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -1706,14 +1706,12 @@ void CClientPed::SetUsesCollision(bool bUsesCollision) float CClientPed::GetMaxHealth() { - // TODO: Verify this formula - // Grab his player health stat float fStat = GetStat(MAX_HEALTH); // Do a linear interpolation to get how much health this would allow - // Assumes: 100 health = 569 stat, 200 health = 1000 stat. - float fMaxHealth = 100.0f + (100.0f / 431.0f * (fStat - 569.0f)); + // Assumes: 100 health = 569 stat, 176 health = 1000 stat. + float fMaxHealth = fStat * 0.176f; // Return the max health. Make sure it can't be below 1 if (fMaxHealth < 1.0f) diff --git a/Server/mods/deathmatch/logic/CPed.cpp b/Server/mods/deathmatch/logic/CPed.cpp index ba50c25caa..37b012be18 100644 --- a/Server/mods/deathmatch/logic/CPed.cpp +++ b/Server/mods/deathmatch/logic/CPed.cpp @@ -369,14 +369,12 @@ bool CPed::HasWeaponType(unsigned char ucWeaponType) float CPed::GetMaxHealth() { - // TODO: Verify this formula - // Grab his player health stat float fStat = GetPlayerStat(24 /*MAX_HEALTH*/); // Do a linear interpolation to get how much health this would allow - // Assumes: 100 health = 569 stat, 200 health = 1000 stat. - float fMaxHealth = 100.0f + (100.0f / 431.0f * (fStat - 569.0f)); + // Assumes: 100 health = 569 stat, 176 health = 1000 stat. + float fMaxHealth = fStat * 0.176f; // Return the max health. Make sure it can't be below 1 if (fMaxHealth < 1.0f)