Skip to content

hpbar on hud is not compatible visually with MAX_HEALTH stat #3807

Open
@ghost

Description

Describe the bug

Hello!

I came to report a bug which I'm sure existed for years. I don't know if this bug wasn't noticed or it isn't fixable. I searched about it on github but maybe it was a report on mantis who knows.

In the singleplayer the hpbar is dinamically growing by the fact that CJ exercises his body. It grows to a maximum of 150 hp. This can also be achieved by doing the paramedic missions.

The hpbar is designed to show hp between 0 and 150.

However in MTA for some reason we have maximum hp of 200. (possibly because we can't set armor to have 150 maximum armor, but it is just my accusation)

Steps to reproduce

Launch a local server and observe the hpbar after executing some commands.

first get the current value of MAX_HEALTH it will be useful when resetting:

getPedStat(getPlayerFromName("derxgbb"),24)

derxgbb executed command: getPedStat(getPlayerFromName("derxgbb"),24)
Command results: 569 [number]

Now set it to 1000 so the hpbar will get its maximum width.

setPedStat(getPlayerFromName("derxgbb"), 24, 1000)

derxgbb executed command: setPedStat(getPlayerFromName("derxgbb"), 24, 1000)
Command results: true [boolean]

By default we have 100hp with a maximum of 200 now. The hp on the bar is 'kinda' in the middle as it should.
Now set the hp to 150

setElementHealth(getPlayerFromName("derxgbb"),150)

derxgbb executed command: setElementHealth(getPlayerFromName("derxgbb"),150)
Command results: true [boolean]

It will look like its almost full, but there is still 50hp left.
Now set it to 173.

setElementHealth(getPlayerFromName("derxgbb"),173)

derxgbb executed command: setElementHealth(getPlayerFromName("derxgbb"),173)
Command results: true [boolean]

With 173hp it maximises and the 27hp which is left till 200 is not shown. Image

Version

It happens on all versions for years.
Currently:
Server & Client: 22771

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions