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

isPlayerHudComponentVisible only works with setPlayerHudComponentVisible #547

Open
ArranTuna opened this issue Sep 21, 2018 · 6 comments · May be fixed by #3634
Open

isPlayerHudComponentVisible only works with setPlayerHudComponentVisible #547

ArranTuna opened this issue Sep 21, 2018 · 6 comments · May be fixed by #3634
Labels
bug Something isn't working
Milestone

Comments

@ArranTuna
Copy link
Collaborator

ArranTuna commented Sep 21, 2018

Describe the bug
when Using isPlayerHudComponentVisible( string Component) returns always true until using setPlayerHudComponentVisible

Examples when it is wrong:

  1. User uses showHud command there is no Hud but isPlayerHudComponentVisible says there is a hud visible
  2. the breath is always true but when a player is not in water there is no breath in the hud
  3. sing Camerafunctions like setCameraTarget oder setCameraMatrix always hide Health, Money, Weapon... but isPlayerHudComponentVisible says it is visible.

To reproduce

  • showhud
  • crun isPlayerHudComponentVisible("health") returns true when should be false

Expected behaviour
To return false when component not on screen.

Screenshots
If applicable, add screenshots to help explain your problem.

MTA Client:

  • Version:
  • Running in Wine?

MTA Server:

  • Version
  • OS:

Additional context
Add any other context about the problem here

From https://bugs.mtasa.com/view.php?id=7356

@ArranTuna ArranTuna added the bug Something isn't working label Sep 21, 2018
@ArranTuna ArranTuna added this to the Backlog milestone Sep 21, 2018
@qaisjp
Copy link
Contributor

qaisjp commented Sep 21, 2018

This is a weird one. There needs to be a distinction between "visible" and "enabled"...

@qaisjp qaisjp changed the title isPlayerHudComponentVisible only works with showPlayerHudComponent isPlayerHudComponentVisible only works with setPlayerHudComponentVisible Aug 10, 2020
@qaisjp
Copy link
Contributor

qaisjp commented Aug 10, 2020

I don't think we can just change the default behaviour of is/setPlayerHudComponentVisible to be aware that sometimes the HUD is enabled, but not visible.

One way to solve this problem is to change the syntax from:

bool isPlayerHudComponentVisible( string component )

To:

bool isPlayerHudComponentVisible(string component, bool checkEnabled=true)

And carefully document that by default it checks that the HUD component is enabled, rather than visible on screen. And that scripters need to provide ..., false) to actually check for current visibility.

Thoughts, @Unde-R, @patrikjuvonen?

@Unde-R
Copy link
Contributor

Unde-R commented Aug 10, 2020

looks good to me

@Unde-R
Copy link
Contributor

Unde-R commented Aug 11, 2020

@qaisjp bool CStaticFunctionDefinitions::IsPlayerHudComponentVisible(eHudComponent component, bool& bOutIsVisible, bool checkEnabled = true)

@Unde-R
Copy link
Contributor

Unde-R commented Aug 11, 2020

@qaisjp bool CStaticFunctionDefinitions::IsPlayerHudComponentVisible(eHudComponent component, bool& bOutIsVisible, bool checkEnabled = true)

Like this right? (let me test it tho)

@qaisjp
Copy link
Contributor

qaisjp commented Aug 11, 2020

something like that. I guess you can go ahead and update your PR with an implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants