Skip to content

Commit

Permalink
Fix #414 Using setElementHealth on a dead ped makes it invincible (#3507
Browse files Browse the repository at this point in the history
)
  • Loading branch information
FileEX authored Jun 24, 2024
1 parent 2c4e232 commit 8368883
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Client/mods/deathmatch/logic/CClientPed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,11 @@ void CClientPed::InternalSetHealth(float fHealth)
}
else
{
// Ped is alive again (Fix #414)
UnlockHealth();
UnlockArmor();
SetIsDead(false);

// Recreate the player
ReCreateModel();
}
Expand Down
3 changes: 3 additions & 0 deletions Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,9 @@ bool CStaticFunctionDefinitions::SetElementHealth(CElement* pElement, float fHea
unsigned char ucHealth = static_cast<unsigned char>(fHealth * 1.25f);
fHealth = static_cast<float>(ucHealth) / 1.25f;
pPed->SetHealth(fHealth);

if (pPed->IsDead() && fHealth > 0.0f)
pPed->SetIsDead(false);
}
else
return false;
Expand Down

0 comments on commit 8368883

Please sign in to comment.