[FREE] [SCRIPT] Minimalist HUD (QBCore, ESX, Standalone)

Please fix the resmon on the hud this is actually so nice

1 Like

ikr the hud is fire but the resmon is horrid

1 Like

I know this is just my lack of knowledge when it comes to things UI, but I am trying to make the bars go backwards? Is there an easy way to do this? I have the status on the left side instead of the right and would just like them to go down towards the map instead of away. https://i.ibb.co/Ln9qF97/Five-M-b2944-GTAProcess-tsn3-JIH9w-T.png Overall fantastic hud, just wanted to change it a tiny bit.

Please make sure to properly license your work.

1 Like

Is it possible to add a file for changing street names also?

Because I see zones en zipcode can be changed and not the street names

The Script is very Nice but can u implement something that shows the ID from the player?

The script retrieves street names directly from the game. However, I had to create a zones.json file because when you retrieve the region where the player is, you simply retrieve a code and not the full name of the region.

However, the code can easily be modified to match your street names, although you’ll need to take time to modify each street name one by one.

I’ve added it to the github page in the readme. I don’t know if I should put it elsewhere or not? (and I don’t know if I did it right either)

I must admit that I currently have less time to devote to this simple hud, which is why it’s open source and free, and why I let anyone who wants to modify it do so. But unfortunately I’m not going to take care of adding each request one by one.
I’m sorry, I would have done so in the beginning, but it’s no longer possible.

At the moment I can’t say, but I think it’s enough to play with the values I have in the javascript, or simply reverse the position of the two bars in the css.
Now I’m just saying it off the top of my head, it’s been a long time since I’ve seen the code for this HUD.

I’ll try to improve this in the future, but unfortunately I don’t have the time to do it at the moment.
But don’t hesitate, it’s an open source script, so if you have any suggestions to make!

Hi, I have modified part of your code to support the following features:

  • Multi-language support
  • Automatic adaptation to screen safe boundaries

Due to the high activity on the forum thread, I’m posting this code here instead of submitting a PR on GitHub.

cl_main.lua

-- https://github.com/glitchdetector/fivem-minimap-anchor/blob/master/MINIANCHOR.lua
function GetMinimapAnchor()
    local safezone = GetSafeZoneSize()
    local safezone_x = 1.0 / 20.0
    local safezone_y = 1.0 / 20.0
    local aspect_ratio = GetAspectRatio(0)
    local res_x, res_y = GetActiveScreenResolution()
    local xscale = 1.0 / res_x
    local yscale = 1.0 / res_y
    local Minimap = {}
    Minimap.width = xscale * (res_x / (4 * aspect_ratio))
    Minimap.height = yscale * (res_y / 5.674)
    Minimap.left_x = xscale * (res_x * (safezone_x * ((math.abs(safezone - 1.0)) * 10)))
    Minimap.bottom_y = 1.0 - yscale * (res_y * (safezone_y * ((math.abs(safezone - 1.0)) * 10)))
    Minimap.right_x = Minimap.left_x + Minimap.width
    Minimap.top_y = Minimap.bottom_y - Minimap.height
    Minimap.x = Minimap.left_x
    Minimap.y = Minimap.top_y
    Minimap.xunit = xscale
    Minimap.yunit = yscale
    return Minimap
end


Citizen.CreateThread(function()
    while true do
		Citizen.Wait(1000)
        if hudvisible == true then
            local n = GetMinimapAnchor()
            local x, y = GetActiveScreenResolution()
            local data = {
                component="configuration",
                locationleft = n.right_x * x,
                locationbottom = (1 - n.bottom_y) * y + 25,
                statusright = 0.02 * x,
                statusbottom = (1 - n.bottom_y) * y + 25,
                speedometerbottom = (1 - n.bottom_y) * y - 55,
                language = GetCurrentLanguage()
            }
            SendNuiMessage(json.encode(data))
        end
	end
end)

script.js

    if(event.data.component == "configuration"){
        locationWindow.style.left = event.data.locationleft + "px"
        locationWindow.style.bottom = event.data.locationbottom + "px"
        statusWindow.style.right = event.data.statusright + "px"
        statusWindow.style.bottom = event.data.statusbottom + "px"
        speedometerWindow.style.bottom = event.data.speedometerbottom + "px"
        languageCode = event.data.language

        const translations = {
            0: {
                'oxygen': 'Oxygen',
                'armor': 'Armor',
                'thirst': 'Thirst',
                'food': 'Hunger',
                'health': 'Health'
            },
            1: {
                'oxygen': 'Oxygène',
                'armor': 'Armure',
                'thirst': 'Soif',
                'food': 'Faim',
                'health': 'Santé'
            },
            2: {
                'oxygen': 'Sauerstoff',
                'armor': 'Rüstung',
                'thirst': 'Durst',
                'food': 'Hunger',
                'health': 'Gesundheit'
            },
            3: {
                'oxygen': 'Ossigeno',
                'armor': 'Armatura',
                'thirst': 'Sete',
                'food': 'Fame',
                'health': 'Salute'
            },
            4: {
                'oxygen': 'Oxígeno',
                'armor': 'Armadura',
                'thirst': 'Sed',
                'food': 'Hambre',
                'health': 'Salud'
            },
            5: {
                'oxygen': 'Oxigênio',
                'armor': 'Armadura',
                'thirst': 'Sede',
                'food': 'Fome',
                'health': 'Saúde'
            },
            6: {
                'oxygen': 'Tlen',
                'armor': 'Pancerz',
                'thirst': 'Pragnienie',
                'food': 'Głód',
                'health': 'Zdrowie'
            },
            7: {
                'oxygen': 'Кислород',
                'armor': 'Броня',
                'thirst': 'Жажда',
                'food': 'Голод',
                'health': 'Здоровье'
            },
            8: {
                'oxygen': '산소',
                'armor': '갑옷',
                'thirst': '갈증',
                'food': '배고픔',
                'health': '건강'
            },
            9: {
                'oxygen': '氧氣',
                'armor': '護甲',
                'thirst': '口渴',
                'food': '飢餓',
                'health': '健康'
            },
            10: {
                'oxygen': '酸素',
                'armor': '鎧',
                'thirst': '渇き',
                'food': '空腹',
                'health': '健康'
            },
            11: {
                'oxygen': 'Oxígeno',
                'armor': 'Armadura',
                'thirst': 'Sed',
                'food': 'Hambre',
                'health': 'Salud'
            },
            12: {
                'oxygen': '氧气',
                'armor': '护甲',
                'thirst': '口渴',
                'food': '饥饿',
                'health': '健康'
            }
        };

        if (translations[languageCode]) {
            document.querySelectorAll('[data-translate]').forEach(element => {
                const key = element.getAttribute('data-translate');
                if (translations[languageCode][key]) {
                    element.textContent = translations[languageCode][key];
                }
            });
        }

index.html

    <section id="status">
        <img id="voice" class="voice" src="mic_mute.png">
        <div id="oxygencontainer" class="oxygen">
            <span class="title" data-translate="oxygen">Oxygen</span>
            <img src="oxygen.png">
            <hr id="oxygen">
            <span id="oxygentext">100%</span>
        </div>
        <div id="armorcontainer" class="armor">
            <span class="title" data-translate="armor">Armor</span>
            <img src="armor.png">
            <hr id="armor">
            <span id="armortext">100%</span>
        </div>
        <div id="thirstcontainer" class="thirst">
            <span class="title" data-translate="thirst">Thirst</span>
            <img src="thirst.png">
            <hr id="thirst">
            <span id="thirsttext">100%</span>
        </div>
        <div id="foodcontainer" class="food">
            <span class="title" data-translate="food">Hunger</span>
            <img src="food.png">
            <hr id="food">
            <span id="foodtext">100%</span>
        </div>
        <div id="healthcontainer" class="health">
            <span class="title" data-translate="health">Health</span>
            <img src="health.png">
            <hr id="health">
            <span id="healthtext">100%</span>
        </div>
    </section>
1 Like

can u optimize it?

Hello, i tried to change de colors of the HUD but i cant find the right place to do it. How should i do it ? And how do i change the MPH to KMH ? And last question, i have a script for a seatbelt, how to i export it to work with this HUD ?

(post deleted by author)