[Release | Utility] Minimap Anchor Script

Been trying to get this to work for a while now then decided just to try using the example and even the example doesn’t work unless specifically in fullscreen at 1920x1080. In any other resolution or windowed mode the border is offset. Anyone got any ideas on what I’m doing wrong or is this outdated?

well…

Hi there, just made a little “fork” of the script to make it work like some kind of “library” script
Also added support for 21:9 aspect ratio
You can find it here

PS: I’ve not tested all screen configurations but tested the most common ratios and resolutions, if you find errors feel free to add new issues.

My stupid ass can’t even get the rectangle to show up, so I don’t expect to get any help here, but I still have hopes. Okay, so I’ve set my screen resolution to borderless windowed mode at 1920x1080. Pretty standard. I’ve then gone ahead and moved the “MINIANCHOR.lua” to the “simplecarhud” resource folder. I’ve gone ahead and changed this:

client_script 'SimpleCarHUD_cl.lua'

to this:

client_script {
    'MINIANCHOR.lua',
    'SimpleCarHUD.lua'
}

I have then, to check if it would work at all, commented out everything inside the “SimpleCarHUD.lua” and put the example to draw a rectangle inside it:

function drawRct(x, y, width, height, r, g, b, a)
    DrawRect(x + width/2, y + height/2, width, height, r, g, b, a)
end
Citizen.CreateThread(function()
    while true do
        Wait(0)
        local ui = GetMinimapAnchor()
        local thickness = 4 -- Defines how many pixels wide the border is
        drawRct(ui.x, ui.y, ui.width, thickness * ui.yunit, 0, 0, 0, 255)
        drawRct(ui.x, ui.y + ui.height, ui.width, -thickness * ui.yunit, 0, 0, 0, 255)
        drawRct(ui.x, ui.y, thickness * ui.xunit, ui.height, 0, 0, 0, 255)
        drawRct(ui.x + ui.width, ui.y, -thickness * ui.xunit, ui.height, 0, 0, 0, 255)
    end
end)

Nothing showed up. Then, in a desperate attempt to get any sign of life, I’ve also added it to the “MINIANCHOR.lua”, but still, no success. I’ve tried restarting the game, the fullscreen mode, still no success. I know that it must be my fault so I’ll do the only thing plausible: Blame sleep deprivation.

This should be client_scripts, not client_script
Nothing else seems to be incorrect in the post

anyone willing to share this ?

2 Likes

I want help my mini map is appearing and disappearing what should i do ?

Okay, I need this, but I am still learning. How do I install this? Any help much appreciated.

Can I take the fuel and mph bar and make it into a HUD?

I haven’t really tested this in much of a capacity with different aspect ratios.
My solution on my own servers and games have been to allow users to configure offsets and size manually to fix it.

See https://github.com/glitchdetector/fivem-lite-transportation/blob/master/resources/sessionmanager/scripts/dependencies/minimapper.lua#L45-L51 for how it’s done in LITE Transportation.
I can’t really give a plug and play solution, but in there I used a simple WarMenu setup to configure the values.

you’ll made it, when the screen bigger 1920x1080, i think