Describe the bug
when Using isPlayerHudComponentVisible( string Component) returns always true until using setPlayerHudComponentVisible
Examples when it is wrong:
To reproduce
showhudcrun isPlayerHudComponentVisible("health") returns true when should be falseExpected behaviour
To return false when component not on screen.
Screenshots
If applicable, add screenshots to help explain your problem.
MTA Client:
MTA Server:
Additional context
Add any other context about the problem here
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