Mtasa-blue: isPlayerHudComponentVisible only works with setPlayerHudComponentVisible

Created on 21 Sep 2018  路  6Comments  路  Source: multitheftauto/mtasa-blue

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

bug

All 6 comments

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

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?

looks good to me

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

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

Like this right? (let me test it tho)

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

Was this page helpful?
0 / 5 - 0 ratings