HEX
ESXHuds

Installation

Here you will get the full Installation guide to setup our huds with Jaksams creators.

Notify

To install our Notifys for ESX, follow these steps:

Open the File

Open your es_extended resource folder and navigate to client/functions.lua file and open it.

Replace Code

Search for the function named ESX.ShowNotification and replace the code with our code.

function ESX.ShowNotification(message, notifyType, length, title, position)
    if title == nil then title = 'Information' end
    if notifyType == nil then notifyType = 'info' end
    if length == nil then length = 5000 end

    if GetResourceState('hex_1_hud') == 'started' then
        exports['hex_1_hud']:Notify(title, message, notifyType, length)
    elseif GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:Notify(title, message, notifyType, length)
    elseif GetResourceState('hex_4_hud') == 'started' then
        exports['hex_4_hud']:Notify(title, message, notifyType, length)
    elseif GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:Notify(title, message, notifyType, length)
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:Notify(title, message, notifyType, length)
    elseif GetResourceState('hex_hud') == 'started' then
        exports['hex_hud']:Notify(title, message, notifyType, length)
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:Notify(title, message, notifyType, length)
    else
        return IsResourceFound('esx_notify') and exports['esx_notify']:Notify(notifyType or 'info', length or 5000, message, title, position)
    end
end

Restart Server

Restart your server to apply the changes.

Progressbar

To install our Progressbar for ESX, follow these steps:

Open the File

Open your es_extended resource folder and navigate to client/functions.lua file and open it.

Replace Code

Search for the function named ESX.Progressbar and replace the code with our code.

function ESX.Progressbar(message, length, options)
    if GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:StartProgressbar(length, message)
    elseif GetResourceState('hex_4_hud') == 'started' then
        exports['hex_4_hud']:StartProgressbar(length, message)
    elseif GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:StartProgressbar(length, message)
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:StartProgressbar(length, message)
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:StartProgressbar(length, message)
    else
        return IsResourceFound('esx_progressbar') and exports['esx_progressbar']:Progressbar(message, length, options)
    end
end

Search for the function named ESX.CancelProgressbar and replace the code with our code.

function ESX.CancelProgressbar()
    if GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:StopProgressbar()
    elseif GetResourceState('hex_4_hud') == 'started' then
        exports['hex_4_hud']:StopProgressbar()
    elseif GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:StopProgressbar()
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:StopProgressbar()
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:StopProgressbar()
    else
        return IsResourceFound('esx_progressbar') and exports['esx_progressbar']:CancelProgressbar()
    end
end

Restart Server

Restart your server to apply the changes.

TextUI

To install our TextUI for ESX, follow these steps:

Open the File

Open your es_extended resource folder and navigate to client/functions.lua file and open it.

Replace Code

Search for the function named ESX.TextUI and replace the code with our code.

function ESX.TextUI(message, type)
    local cleanMessage = message:gsub('~.-~', ''):gsub('[%[%]]', '')

    if GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:ShowHelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_4_hud') == 'started' then
        exports['hex_4_hud']:ShowHelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:ShowHelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:ShowHelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:ShowHelpNotify(cleanMessage, 'E')
    else
        return IsResourceFound('esx_textui') and exports['esx_textui']:TextUI(message, type)
    end
end

Search for the function named ESX.HideUI and replace the code with our code.

function ESX.HideUI()
    if GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:HideHelpNotify()
    elseif GetResourceState('hex_4_hud') == 'started' then
        exports['hex_4_hud']:HideHelpNotify()
    elseif GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:HideHelpNotify()
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:HideHelpNotify()
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:HideHelpNotify()
    else
        return IsResourceFound('esx_textui') and exports['esx_textui']:HideUI()
    end
end

Search for the function named ESX.ShowHelpNotification and replace the code with our code.

function ESX.ShowHelpNotification(message, thisFrame, beep, duration)
    local cleanMessage = message:gsub('~.-~', ''):gsub('[%[%]]', '')

    if GetResourceState('hex_2_hud') == 'started' then
        exports['hex_2_hud']:HelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_4_hud') == 'started' then
        exports['hex_4_hud']:HelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_final_hud') == 'started' then
        exports['hex_final_hud']:HelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_future_hud') == 'started' then
        exports['hex_future_hud']:HelpNotify(cleanMessage, 'E')
    elseif GetResourceState('hex_hud_prem') == 'started' then
        exports['hex_hud_prem']:HelpNotify(cleanMessage, 'E')
    else
        AddTextEntry('esxHelpNotification', message)

        if thisFrame then
            DisplayHelpTextThisFrame('esxHelpNotification', false)
        else
            BeginTextCommandDisplayHelp('esxHelpNotification')
            EndTextCommandDisplayHelp(0, false, beep == nil or beep, duration or -1)
        end
    end
end

Restart Server

Restart your server to apply the changes.

Paycheck

To install our Paycheck Notify for ESX, follow these steps:

Open the File

Open your es_extended resource folder and navigate to server/modules/paycheck.lua file and open it.

Replace Code

Search for the function named StartPayCheck and replace the code with our code.

function StartPayCheck()
    CreateThread(function()
        while true do
            Wait(Config.PaycheckInterval)

            local eventPrefix = nil
            if GetResourceState('hex_1_hud') == 'started' then
                eventPrefix = 'hex_1_hud'
            elseif GetResourceState('hex_2_hud') == 'started' then
                eventPrefix = 'hex_2_hud'
            elseif GetResourceState('hex_4_hud') == 'started' then
                eventPrefix = 'hex_4_hud'
            elseif GetResourceState('hex_final_hud') == 'started' then
                eventPrefix = 'hex_final_hud'
            elseif GetResourceState('hex_future_hud') == 'started' then
                eventPrefix = 'hex_future_hud'
            elseif GetResourceState('hex_hud') == 'started' then
                eventPrefix = 'hex_hud'
            elseif GetResourceState('hex_hud_prem') == 'started' then
                eventPrefix = 'hex_hud'
            end

            for player, xPlayer in pairs(ESX.Players) do
                local jobLabel = xPlayer.job.label
                local job = xPlayer.job.grade_name
                local onDuty = xPlayer.job.onDuty
                local salary = (job == 'unemployed' or onDuty) and xPlayer.job.grade_salary or ESX.Math.Round(xPlayer.job.grade_salary * Config.OffDutyPaycheckMultiplier)

                if xPlayer.paycheckEnabled then
                    if salary > 0 then
                        if job == 'unemployed' then -- unemployed
                            xPlayer.addAccountMoney('bank', salary, 'Welfare Check')

                            if Config.LogPaycheck then
                                ESX.DiscordLogFields('Paycheck', 'Paycheck - Unemployment Benefits', 'green', {
                                    { name = 'Player', value = xPlayer.name, inline = true },
                                    { name = 'ID', value = xPlayer.source, inline = true },
                                    { name = 'Amount', value = salary, inline = true }
                                })
                            end

                            if eventPrefix ~= nil then
                                TriggerClientEvent(('%s:notify'):format(eventPrefix), player, TranslateCap('received_paycheck'), TranslateCap('received_help', salary), 'info', 5000)
                            else
                                TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_help", salary), "CHAR_BANK_MAZE", 9)
                            end
                        elseif Config.EnableSocietyPayouts then -- possibly a society
                            TriggerEvent('esx_society:getSociety', xPlayer.job.name, function(society)
                                if society ~= nil then -- verified society
                                    TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
                                        if account.money >= salary then -- does the society money to pay its employees?
                                            xPlayer.addAccountMoney('bank', salary, 'Paycheck')
                                            account.removeMoney(salary)

                                            if Config.LogPaycheck then
                                                ESX.DiscordLogFields('Paycheck', 'Paycheck - ' .. jobLabel, 'green', {
                                                    { name = 'Player', value = xPlayer.name, inline = true },
                                                    { name = 'ID', value = xPlayer.source, inline = true },
                                                    { name = 'Amount', value = salary, inline = true }
                                                })
                                            end

                                            if eventPrefix ~= nil then
                                                TriggerClientEvent(('%s:notify'):format(eventPrefix), player, TranslateCap('received_paycheck'), TranslateCap('received_salary', salary), 'info', 5000)
                                            else
                                                TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
                                            end
                                        else
                                            if eventPrefix ~= nil then
                                                TriggerClientEvent(('%s:notify'):format(eventPrefix), player, 'Gehaltscheck nicht erhalten', TranslateCap('company_nomoney'), 'info', 5000)
                                            else
                                                TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), "", TranslateCap("company_nomoney"), "CHAR_BANK_MAZE", 1)
                                            end
                                        end
                                    end)
                                else -- not a society
                                    xPlayer.addAccountMoney('bank', salary, 'Paycheck')

                                    if Config.LogPaycheck then
                                        ESX.DiscordLogFields('Paycheck', 'Paycheck - ' .. jobLabel, 'green', {
                                            { name = 'Player', value = xPlayer.name, inline = true },
                                            { name = 'ID', value = xPlayer.source, inline = true },
                                            { name = 'Amount', value = salary, inline = true }
                                        })
                                    end

                                    if eventPrefix ~= nil then
                                        TriggerClientEvent(('%s:notify'):format(eventPrefix), player, TranslateCap('received_paycheck'), TranslateCap('received_salary', salary), 'info', 5000)
                                    else
                                        TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
                                    end
                                end
                            end)
                        else -- generic job
                            xPlayer.addAccountMoney('bank', salary, 'Paycheck')

                            if Config.LogPaycheck then
                                ESX.DiscordLogFields('Paycheck', 'Paycheck - Generic', 'green', {
                                    { name = 'Player', value = xPlayer.name, inline = true },
                                    { name = 'ID', value = xPlayer.source, inline = true },
                                    { name = 'Amount', value = salary, inline = true }
                                })
                            end

                            if eventPrefix ~= nil then
                                TriggerClientEvent(('%s:notify'):format(eventPrefix), player, TranslateCap('received_paycheck'), TranslateCap('received_salary', salary), 'info', 5000)
                            else
                                TriggerClientEvent("esx:showAdvancedNotification", player, TranslateCap("bank"), TranslateCap("received_paycheck"), TranslateCap("received_salary", salary), "CHAR_BANK_MAZE", 9)
                            end
                        end
                    end
                end
            end
        end
    end)
end

Restart Server

Restart your server to apply the changes.