-
Notifications
You must be signed in to change notification settings - Fork 37
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
Create esx_hud #82
Conversation
added the function of the stress icon and the drunk icon
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where drunk bar?
web/DefaultDatas.js
Outdated
@@ -29,6 +29,7 @@ const progressColors = { | |||
foodBar: "yellow", | |||
oxygenBar: "green", | |||
staminaBar: "purple", | |||
stressBar: "orange" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment, where drunkBar?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comment
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' |
There was a problem hiding this comment.
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)
There was a problem hiding this 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
There was a problem hiding this 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
shared/config.lua
Outdated
@@ -1,4 +1,4 @@ | |||
Config = { | |||
CVConfig = { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove comments
@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. |
@Rangerhitam12 Please remove all comments in codebase like "add this line", etc. |
Uploading esx_hud.zip…
added the function of the stress icon