Skip to content

Commit

Permalink
Fix max health formula
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNormalnij committed Jan 8, 2025
1 parent c197cf8 commit 0a8f421
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions Server/mods/deathmatch/logic/CPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a8f421

Please sign in to comment.