[Release] [vRP] [ESX] Hud of thirst and hunger for FiveM (ladderhud)

Hi there! I love the UI and I have been able to get it to work on my older server, but I recently did a migration, and I haven’t been able to get both of bars to work.

inventoryhud
As of right now, only the get the thirst bar to work. I’ve reinstalled both status and basic needs a few times, with no success. I’ve noticed that if I attempt to install other status bar resources, it does the same thing.
Has anyone else had this issue and found a solution?

1 Like

Any errors?

Everything looks fine in the console. I tried replacing the GetStatusData function with the status variable in esx_status, and am still having the same issue. (Code below)
I have the esx_stat:onTick uncommented so I can still see the needs bar.

I’m not too sure what else to try.

RegisterNetEvent('esx_status:load')
AddEventHandler('esx_status:load', function(status)
	for i=1, #Status, 1 do
		for j=1, #status, 1 do
			if Status[i].name == status[j].name then
				Status[i].set(status[j].val)
			end
		end
	end

	Citizen.CreateThread(function()
		while true do
			for i=1, #Status, 1 do
				Status[i].onTick()
			end

			SendNUIMessage({
				update = true,
				status = GetStatusData()
			})
			TriggerEvent('esx_ladderhud:updateBasics', GetStatusData(true)) 
            --TriggerEvent('esx_ladderhud:updateBasics', status)        
			TriggerEvent('esx_status:onTick', GetStatusData(true))
			Citizen.Wait(Config.TickTime)
		end
	end)
end)

How can I change the position of the hud? I’d like to put it down here:

1 Like

You say other status bar resources have the same issue. I’m guessing the default esx_basicneeds status bars also have the same issue after your migration?

If so, I would guess the issue to be related to the values that are being retrieved and worked with for the status bar itself.

Since you say it was a migration and not a complete fresh server, is it safe to assume you are using your original database and didn’t wipe it clean?

If so, I would suggest you take a look at your Databases values under status in your users table.

Assuming your database is named essentialmode… MySQL commands to check status values:

USE `essentialmode`;
SELECT `status` FROM `users`;

Here’s what the output should look like (a single status value from my database)

[{“name”:“hunger”,“val”:716000,“percent”:71.6},{“name”:“thirst”,“val”:787000,“percent”:78.7}]

(my server is very current; just started development 2 weeks ago… but haven’t installed any custom status bar resources yet. So just using the default ones and they are of course working fine)

If your status values are different/missing anything, I would drop the column and recreate it.

ALTER TABLE `users` DROP `status`;
ALTER TABLE `users` ADD COLUMN `status` LONGTEXT NULL;

Hopefully this helped. I would also suggest adding this line to the top of your server.cfg (above your database credentials) to have debugging output into your server’s console

set mysql_debug 1
1 Like

Awesome! Thank you so much!
I ran the first query and got a look at my status column, and I noticed some problems. I ran the second set of queries and that fixed the SQL problem over all. Now my status column looks like this:

[{"percent":0.0,"name":"drunk","val":0},{"percent":49.43,"name":"hunger","val":494300},{"percent":49.5725,"name":"thirst","val":495725}]

So from that logic, that means, basic[1] is actually drunkenness. I tested with beer and my hunger filled! I changed ladderhud client lua to this:

AddEventHandler("esx_ladderhud:updateBasics", function(basics)
    hunger, thirst = basics[2].percent, basics[3].percent
end)

Now works like a dream! Thank you for the help, my friend!

2 Likes

Ey!, can u help me guys?

Vrp version working but i don’t get any damage when hungry or thirsty

1 Like

someone tells me where I can change the place where it appears and if it would be a lot of trouble they could tell me how to put it on top of the map (coordinates)

Done all the things in the README file but there is only a UI coming out without really counting and the basic one is still there even i replace all the things the file told me to.

New ESX-HUD:

where to install that esx hud?

This is a exampe Hud when you need this hud write me on a private message

Do you know why I didnt have hunger and no lost hunger?

Add TriggerEvent in (resources[esx]\esx_status\client\main.lua esx_status:load)
TriggerEvent('esx_ladderhud:updateBasics', GetStatusData(true))
to look like this

RegisterNetEvent('esx_status:load')
AddEventHandler('esx_status:load', function(status)

	for i=1, #Status, 1 do
		for j=1, #status, 1 do
			if Status[i].name == status[j].name then
				Status[i].set(status[j].val)
			end
		end
	end

	Citizen.CreateThread(function()
	  while true do

	  	for i=1, #Status, 1 do
	  		Status[i].onTick()
	  	end

			SendNUIMessage({
				update = true,
				status = GetStatusData()
			})
	
		TriggerEvent('esx_ladderhud:updateBasics', GetStatusData(true))
	    Citizen.Wait(Config.TickTime)
	  end
	end)

end)
Disabling Basic Needs Bars (resources[esx]\esx_basicneeds\client\main.lua esx_status:loaded)
AddEventHandler('esx_status:loaded', function(status)

	TriggerEvent('esx_status:registerStatus', 'hunger', 1000000, '#FFFF00', -- amarelo
	--TriggerEvent('esx_status:registerStatus', 'hunger', 1000000, '#CFAD0F', -- GOLD
		function(status)
			return false -- Change to true to show hunger bar | false to hide hunger bar
		end, function(status)
			status.remove(100)
		end
	)

	TriggerEvent('esx_status:registerStatus', 'thirst', 1000000, '#0099FF', -- azul
	--TriggerEvent('esx_status:registerStatus', 'thirst', 1000000, '#0C98F1', -- CYAN
		function(status)
			return false -- Change to true to show thirst bar | false to hide thirst bar
		end, function(status)
			status.remove(75)
		end
	)

How to fix ladderhud

Could you please share the hud that you used please?

Please share my friend xd

What is the name of that script with that gas bar?

how do i move the location of the hud?

\resources\ [esx]\esx_ladderhud\HTML\ui.css

and edit the lines 21 and 22.

here is an example of mine:

.container-fluid {
    position: absolute;
    padding: 0;
    margin: 0;
    display: inline-block;
    right: 69vw;
    bottom: 0;
    transition: right 1.0s;
}

as Pouloud said