Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix max health formula #3934

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading