DarkStalker30 Posted April 5, 2025 Posted April 5, 2025 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?
Moderators IIYAMA Posted April 5, 2025 Moderators Posted April 5, 2025 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
DarkStalker30 Posted April 6, 2025 Author Posted April 6, 2025 2 hours ago, IIYAMA said: But as alternative you can draw a bar under it with: 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?
Moderators IIYAMA Posted April 6, 2025 Moderators Posted April 6, 2025 8 hours ago, DarkStalker30 said: If character will be in water while player has black screen by fadeCamera() and HUD off, will it trigger breath bar? 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
DarkStalker30 Posted April 6, 2025 Author Posted April 6, 2025 (edited) 3 hours ago, 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 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, 2025 by DarkStalker30 1
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