DarkStalker30 Posted April 5 Share Posted April 5 Hi guys. In 1.6 was added some new functions for HUD. I liked the idea to use it to draw my stamina bar in place, where is breath bar by default. But then I got a problem - until the player gets into the water, breath bar x, y = 0, 0. Is there a way to force draw that bar without going into water? Link to comment
Moderators IIYAMA Posted April 5 Moderators Share Posted April 5 I don't think there is a way to force it. If it did, then it should be defined here: https://wiki.multitheftauto.com/wiki/HUD_Components#Properties https://wiki.multitheftauto.com/wiki/SetPlayerHudComponentProperty But as alternative you can draw a bar under it with: https://wiki.multitheftauto.com/wiki/DxDrawRectangle https://wiki.multitheftauto.com/wiki/DxSetAspectRatioAdjustmentEnabled https://wiki.multitheftauto.com/wiki/OnClientHUDRender Link to comment
DarkStalker30 Posted April 6 Author Share Posted April 6 On 05/04/2025 at 21:55, IIYAMA said: But as alternative you can draw a bar under it with: Expand That's something that I want to do. And if breath bar has its coords, then all ok. But if not, then stamina bar going to left top corner. I just can't upload images. If character will be in water while player has black screen by fadeCamera() and HUD off, will it trigger breath bar? Link to comment
Moderators IIYAMA Posted April 6 Moderators Share Posted April 6 On 06/04/2025 at 00:36, DarkStalker30 said: If character will be in water while player has black screen by fadeCamera() and HUD off, will it trigger breath bar? Expand It will probably be visible when the camera is fade out. So yes you need to add some more exceptions for unexpected situations. This condition might catch some of the problems: if getCameraTarget () ~= localPlayer then return end Link to comment
DarkStalker30 Posted April 6 Author Share Posted April 6 (edited) On 06/04/2025 at 09:24, IIYAMA said: It will probably be visible when the camera is fade out. So yes you need to add some more exceptions for unexpected situations. This condition might catch some of the problems: if getCameraTarget () ~= localPlayer then return end Expand I found another way. On start interface resource add and instant remove armor to localPlayer, it's turning on armor bar, then taking health bar coords, armorY + (healthY - armorY) / 2 = breathY. And it's working perfect. UPDATE: for correct working of this method you need to let armor bar to be drawn for 1 frame at least. I used a timer, which checking armorX and armorY, until they became not 0, 0. Edited April 6 by DarkStalker30 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now