Skip to content

Fix health pickups being consumed at full health - #5399

Open
Flashmyname wants to merge 1 commit into
multitheftauto:masterfrom
Flashmyname:fix/4124-health-pickup-full
Open

Flashmyname wants to merge 1 commit into
multitheftauto:masterfrom
Flashmyname:fix/4124-health-pickup-full

Conversation

@Flashmyname

Copy link
Copy Markdown
Contributor

Summary

CanUse compared health against a hard-coded 200.0f while the armour branch beside it uses the
real ceiling, which is why armour already refused at full armour and health did not. A player at
full health consumed the pickup and got nothing back.

Both the check and the cap in Use now go through CPed::GetMaxHealth, which reads the
max_health stat the same way SetElementHealth already does, so a raised stat is respected.

Motivation

Fixes #4124. There was a // TODO: calc max health from max_health stat on the line being
changed, and the issue asks for the behaviour of the original game.

Test plan

Walk into a health pickup at full health. Before: it is consumed and no health is gained. After:
it is left alone. setElementHealth(player, 50) and walk in again - consumed and heals.
setPedStat(player, 24, 1000) then walk in at 100 health - usable again, since the ceiling is
now above 100.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

CanUse compared health against a hard-coded 200 while the armour branch
beside it uses the real ceiling, so a player at full health consumed the
pickup and got nothing back. Both the check and the cap in Use now go
through CPed::GetMaxHealth, which reads the max_health stat.

Fixes multitheftauto#4124.
@Flashmyname
Flashmyname force-pushed the fix/4124-health-pickup-full branch from 9fc4305 to 6d5326e Compare September 14, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player being able to pickup health at full health, with a exception

1 participant