How to remove the health and armour bars from the minimap (both GFX edit and Lua code methods!) - Sat, Apr 13, 2024
This was initially posted on the FiveM / CFX forums. You can go directly to the original post below.
Original Post
Hey there! :wave:
I decided to write this tutorial after getting a DM regarding my minimap.gfx edit, and realizing that:
a. I never explained how I did it and b. the .gfx method is not really available on the internet.
Method 1: Modifying the minimap.gfx scaleform
1.Open OpenIV and extract the minimap.gfx file for your new version.
2.Use a GFX edit software, like Release version 15.1.0 · jindrapetrik/jpexs-decompiler · GitHub
3.Open your .gfx file, go to scripts and find the SETUP_HEALTH_ARMOUR(healthType) function:
4.Here, you have to click on Edit ActionScript on the bottom, and change the entire function to this:
function SETUP_HEALTH_ARMOUR(healthType)
{
this.mapType = healthType;
this.restarted = true;
if(this.healthContainer != undefined)
{
if(this.HEALTH_ARMOUR_ABILITY != undefined)
{
this.HEALTH_ARMOUR_ABILITY.removeMovieClip();
}
this.HEALTH_ARMOUR_ABILITY = this.healthContainer.attachMovie("GOLF","GOLF",1,{_visible:false});
}
}
If you compare the two functions (the default one, and the one I provided) you will see that all we are doing is removing most of the logic related to showing the bars, and only keeping the golf minigame one, regardless of healthType.
We are doing this because the during the golf minigame, the health bar is not shown: this.healthContainer.attachMovie(“GOLF”,“GOLF”,1,{_visible:false});, which is exactly what we want. Any hackers also can’t also bring the bars back with code, because the scaleform logic is simply deleted.
P.S.: Last time I did this, I vividly remember just removing like, two lines of code, but I cannot remember for the life of me how I did it, so I came up with this method instead.
5.Save both the actionscript, and the .gfx file. Stream it inside a resource as minimap.gfx, and you’re done!
Method 2: Overwriting the scaleform using Lua code
This one more easy to add / manipulate / remove based on your needs, but it does require running code in a loop (which is not a bad thing if done correctly, btw. You should not be scared of loops! The resmon can’t hurt you!!!)
-
Go in any of your client-scripts (usually, a HUD related one.) (You can even use an existing)
-
Add this code:
--lua. client-side script.
Citizen.CreateThread(function()
local minimap = RequestScaleformMovie("minimap") --get the minimap scaleform A.K.A minimap.gfx
SetRadarBigmapEnabled(true, false) --]
Wait(0) --] This whole nonsense is to not fuck up the other parts of the minimap... not sure why, but it works.
SetRadarBigmapEnabled(false, false) --]
while true do -- forever-loop. You can extend this logic to only hide the bars for specific players, or during a specific time, idk
Wait(0)
BeginScaleformMovieMethod(minimap, "SETUP_HEALTH_ARMOUR") -- starting the same function as the one we modified previously
ScaleformMovieMethodAddParamInt(3) -- overwriting whatever `healthType` the game has, with the GOLF one
EndScaleformMovieMethod() -- end the function, so the game can run it.
end
end)
Shout-out to @glitchdetector , as I found this code in one of their older posts. I decided to put it here so we can have both methods in one place.
This code is simple, and also explained in the in-line. We are basically doing the exact same thing as the GFX edit, but instead of simply removing the other logic, we are constantly overwriting healthType to show(or not show!) what we want.
You can put this snippet in any client-side script that you want, create a new resource just for it, or incorporate the code in an existing client-side loop.
Back to Home
Categories