🔧Installation
Follow the steps on this page in detail to get the HUD working correctly on your server, let's go through the steps!
First of all we want you to know that our script only supports the versions of the three most used frameworks, in previous versions it can be usable but we do not provide support since the development is focused on the updated versions of the ESX, QBOX and QBCore frameworks.
1. Resource Installation
The installation of the script is very simple. First of all, you will make sure you have the dependencies installed on your server.
⚠️DependenciesSecondly, you are going to download the CFX Portal file and then unzip it. Next, you are going to drag the file to your server. When you have completed the process, you are going to go to the server.cfg file and make the following changes:
ensure oxmysql
ensure es_extended
ensure ox_lib
ensure pma-voice
ensure jgs-hud
Then, you must go to the Settings section to customize the hud to your liking. After that, you should remove the old hud scripts such as esx_notify, esx_hud, speedometer or qb-hud.
function ESX.ShowHelpNotification(text, customKey)
local key, textAfter = text:match('[~rgbycfnztopqsmld]*%[?([%a%d])%]?~?[~rgbycfnztopqsmld]*%s*(.*)$')
return exports['jgs-hud']:ShowHelp(customKey or key, textAfter ~= '' and textAfter or text)
end
function ESX.ShowNotification(...)
return exports['jgs-hud']:AddNotify(...)
end
local helpNotifications = {}
function ESX.HideUI()
for text, key in pairs(helpNotifications) do
exports['jgs-hud']:RemoveHelp(key)
helpNotifications[text] = nil
end
end
function ESX.TextUI(message)
if helpNotifications[text] then return end
local key, textAfter = text:match('[~rgbycfnztopqsmld]*%[?([%a%d])%]?~?[~rgbycfnztopqsmld]*%s*(.*)$')
helpNotifications[text] = exports['jgs-hud']:CreateHelp(key or '', textAfter ~= '' and textAfter or text)
return helpNotifications[text]
end
function ESX.ShowAdvancedNotification(sender, subject, msg, textureDict, iconType, flash, saveToBrief, hudColorIndex)
local __type = textureDict and textureDict == 'CHAR_BANK_MAZE' and 'bank' or 'info'
TriggerEvent('jgs:notification', msg, __type, sender, iconType, saveToBrief, flash, hudColorIndex)
end
2. Progress System Installation
1. Factory Function
This is the original QBCore.Functions.Progressbar
function provided by default:
function QBCore.Functions.Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
if GetResourceState('progressbar') ~= 'started' then error('progressbar needs to be started in order for QBCore.Functions.Progressbar to work') end
exports['progressbar']:Progress({
name = name:lower(),
duration = duration,
label = label,
useWhileDead = useWhileDead,
canCancel = canCancel,
controlDisables = disableControls,
animation = animation,
prop = prop,
propTwo = propTwo,
}, function(cancelled)
if not cancelled then
if onFinish then
onFinish()
end
else
if onCancel then
onCancel()
end
end
end)
end
2. Updated Function
Replace the above function with the following code. This updated function supports both progressbar
and jgs-hud
resources:
local DEFAULT_PROGRESS_TYPE = 'bar' -- | 'circle'
local function validateResource(resourceName, callback)
if GetResourceState(resourceName):match('start') then
return callback()
end
return error(string.format("%s needs to be started for QBCore.Functions.Progressbar to work", resourceName))
end
local function executeCallback(callback, ...)
if not callback then return end
callback(...)
end
function QBCore.Functions.Progressbar(name, label, duration, useWhileDead, canCancel, disableControls, animation, prop, propTwo, onFinish, onCancel)
validateResource('jgs-hud', function()
exports['jgs-hud']:addProgress(DEFAULT_PROGRESS_TYPE, label, duration, function(cancelled)
executeCallback(cancelled and onCancel or onFinish)
end)
end)
validateResource('progressbar', function()
exports['progressbar']:Progress({
name = name:lower(),
duration = duration,
label = label,
useWhileDead = useWhileDead,
canCancel = canCancel,
controlDisables = disableControls,
animation = animation,
prop = prop,
propTwo = propTwo,
}, function(cancelled)
executeCallback(cancelled and onCancel or onFinish)
end)
end)
end
3. Explanation
Dual Compatibility: The updated function first checks if
jgs-hud
is started and uses it if available. If not, it defaults toprogressbar
.Validation: The
validateResource
helper function ensures the required resources (jgs-hud
orprogressbar
) are running before executing their respective logic.Callbacks: The
executeCallback
function simplifies the handling ofonFinish
andonCancel
logic.Customization: The
DEFAULT_PROGRESS_TYPE
variable allows you to switch between progress types (e.g.,bar
orcircle
) when usingjgs-hud
.
4. Steps to Replace
Open the file where the original
QBCore.Functions.Progressbar
is defined.Replace the original function with the updated function provided above.
Ensure both
progressbar
andjgs-hud
are properly installed and configured in your server resources.
By making this change, your server will seamlessly support progress bars from both jgs-hud
and progressbar
resources!
Last updated
Was this helpful?