Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create esx_hud #82

Closed
wants to merge 22 commits into from
Closed

Conversation

Rangerhitam12
Copy link

Uploading esx_hud.zip…
added the function of the stress icon

Copy link
Collaborator

@Gellipapa Gellipapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that these are not normal statuses so you should write the logic to disable this in config.lua, I mean the stress and drunk hud part.

name: "stressBar",
progressLevel: 100,
color: "orange",
icon: StressIcon // Pastikan Anda memiliki ikon untuk stress
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

name: "drunkBar",
progressLevel: 100,
color: "purple",
icon: DrunkIcon // Pastikan Anda memiliki ikon untuk drunk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

@@ -11,6 +11,7 @@ Config = {
armorBar = "blue",
drinkBar = "lightblue",
foodBar = "yellow",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where drunk bar?

@@ -29,6 +29,7 @@ const progressColors = {
foodBar: "yellow",
oxygenBar: "green",
staminaBar: "purple",
stressBar: "orange"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where drunk bar?

@@ -64,6 +65,7 @@ const progressLevels = {
foodBar: 80,
oxygenBar: 100,
staminaBar: 100,
stressBar: 50, // Tambahkan nilai sesuai kebutuhan
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment, where drunkBar?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment please

name: "stressBar",
progressLevel: 100,
color: "orange",
icon: StressIcon, // Pastikan Anda memiliki ikon untuk stress
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

name: "drunkBar",
progressLevel: 100,
color: "purple",
icon: DrunkIcon, // Pastikan Anda memiliki ikon untuk drunk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

web/src/assets/translate.json Show resolved Hide resolved
fxmanifest.lua Outdated
@@ -3,7 +3,7 @@ game 'gta5'
lua54 'yes'

description 'The default HUD resource for ESX-Legacy.'
version '1.7.0'
version '1.8.0'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have automatic github actions, and change the version number if we released new version, please revert to old. (1.7.0)

@Gellipapa Gellipapa reopened this Jun 8, 2024
Copy link
Author

@Rangerhitam12 Rangerhitam12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not Config.Disable.Status then
local values = {}
local playerId = PlayerId()

AddEventHandler("esx_status:onTick", function(data)
    local hunger, thirst, stress
    for i = 1, #data do
        if data[i].name == "thirst" then
            thirst = math.floor(data[i].percent)
        end
        if data[i].name == "hunger" then
            hunger = math.floor(data[i].percent)
        end
        if data[i].name == "stress" then
            stress = math.floor(data[i].percent)
        end
    end

    local ped = PlayerPedId()

    values.healthBar = math.floor((GetEntityHealth(ped) - 100) / (GetEntityMaxHealth(ped) - 100) * 100)
    values.armorBar = GetPedArmour(ped)
    values.drinkBar = thirst
    values.foodBar = hunger
    if not Config.Disable.Stress then
        values.stressBar = stress
    end
end)

function HUD:StatusThread()
    values = {}
    CreateThread(function()
        while ESX.PlayerLoaded do
            local oxygen, stamina, drunk
            oxygen = math.floor(GetPlayerUnderwaterTimeRemaining(playerId) * 10)
            stamina = math.floor(100 - GetPlayerSprintStaminaRemaining(playerId))
            if stamina == 0 then
                stamina = 1
            end
            if stamina == 100 then
                stamina = 0
            end

            -- Add drunk status calculation here
            drunk = math.floor(ESX.Game.GetPlayerDrunkLevel(playerId) or 0)  -- Assuming there is a method to get the player's drunk level

            values.oxygenBar = IsPedSwimmingUnderWater(PlayerPedId()) and oxygen or 0
            values.staminaBar = stamina
            if not Config.Disable.Drunk then
                values.drunkBar = drunk  -- Add drunk level to the values table
            end

            SendNUIMessage({ type = "STATUS_HUD", value = values })
            Wait(200)
        end
    end)
end

end

Copy link
Collaborator

@Gellipapa Gellipapa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do this changes

@@ -1,4 +1,4 @@
Config = {
CVConfig = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix please typo

@@ -64,6 +65,7 @@ const progressLevels = {
foodBar: 80,
oxygenBar: 100,
staminaBar: 100,
stressBar: 50, // Tambahkan nilai sesuai kebutuhan
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment please

@@ -64,6 +66,8 @@ const progressLevels = {
foodBar: 80,
oxygenBar: 100,
staminaBar: 100,
stressBar: 50, // Tambahkan nilai sesuai kebutuhan
drunkBar: 0, // Nilai untuk kondisi pemain tidak mabuk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment please

name: "stressBar",
progressLevel: 100,
color: "orange",
icon: StressIcon, // Pastikan Anda memiliki ikon untuk stress
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

name: "drunkBar",
progressLevel: 100,
color: "purple",
icon: DrunkIcon, // Pastikan Anda memiliki ikon untuk drunk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

name: "stressBar",
progressLevel: 100,
color: "orange",
icon: StressIcon // Pastikan Anda memiliki ikon untuk stress
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

name: "drunkBar",
progressLevel: 100,
color: "purple",
icon: DrunkIcon // Pastikan Anda memiliki ikon untuk drunk
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comments

web/src/assets/translate.json Show resolved Hide resolved
@Gellipapa
Copy link
Collaborator

@Rangerhitam12 This doesn't solve the problem of not displaying the HUD in the UI interface, this has to be handled on the UI side as well so that the two statuses can be set based on the config.

@Gellipapa
Copy link
Collaborator

@Rangerhitam12 Please remove all comments in codebase like "add this line", etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants