did u figure this out?
Here you go:
In cl_hud.lua, go to "function needsUpdate() and replace the whole function with this:
function needsUpdate()
if Data.PlayerLoaded then
local hungerValue, thirstValue
TriggerEvent('esx_status:getStatus', 'hunger', function(hunger)
hungerValue = (hunger.val / 1000000) * 100
end)
TriggerEvent('esx_status:getStatus', 'thirst', function(thirst)
thirstValue = (thirst.val / 1000000) * 100
end)
-- Grab needs values.
-- Make sure it's on a 0 - 100 scale
SendNUIMessage({
type = 'update',
hunger = hungerValue,
thirst = thirstValue
})
end
SetTimeout(1000, needsUpdate)
end
needsUpdate()
Then go to RegisterNetEvent(‘scrubz_hud:Init’) and replace the whole thing with this:
RegisterNetEvent('scrubz_hud:Init')
AddEventHandler('scrubz_hud:Init', function()
local plyPed = PlayerPedId()
local currentHealth = GetEntityHealth(plyPed) - 100
local currentArmor = GetPedArmour(plyPed)
Data.Health = currentHealth
Data.Armor = currentArmor
TriggerEvent('esx_status:getStatus', 'hunger', function(hunger)
hungerValue = (hunger.val / 1000000) * 100
end)
TriggerEvent('esx_status:getStatus', 'thirst', function(thirst)
thirstValue = (thirst.val / 1000000) * 100
end)
-- Also grab current needs values (0 - 100 scale)
SendNUIMessage({
type = 'init',
health = currentHealth,
armor = currentArmor,
hunger = hungerValue,
thirst = thirstValue,
stress = stressValue
})
Data.PlayerLoaded = true
end)
Good luck.
Wouldnt this:
RegisterNetEvent('scrubz_hid:Init')
Have to be this?
RegisterNetEvent('scrubz_hud:Init')
I think u just pressed “i” instead of “u” by accident but just want to make sure.
Yeah sorry, I meant U. I’ll change it right now.
Your a real g thank you bud
sorry to ask another question but how would I add this to like esx_basicneeds? I just need an example then I can do it.
Yeah i just tested this out and sadly did not work & i am also needing this to with with basicneeds so would it not be TriggerEvent(‘esx_basicneeds:getStatus’, ‘hunger’, function(hunger)
hungerValue = (hunger.val / 1000000) * 100
end)
TriggerEvent(‘esx_basicneeds:getStatus’, ‘thirst’, function(thirst)
thirstValue = (thirst.val / 1000000) * 100
end)
That is how you make it work with basicneeds. I use it on my server and it works (I use ESX 1.1.0)
No, not on my server atleast, it works with basicneeds for me, just follow the steps and see if that works.
Yeah its strange as i have set it up i go in game press f8 and do init update showmenu
& only thing what works is showmenu i have no hud for food or drink ect so this is going to sound dumb but do i need a any hud then this will work or what because don’t see why i won’t work lol sorry in advance lol.
NVM lol i solved it by adding the trigger to esx_kashacters your a diamond thank your for all your help bud
I have one last question not sure if you would be able to help on this but to get the voice working with To ko Voip would i need to trigger the hud in the to ko Voip file or add a To ko Voip Trigger to the hud?
Here is how to do it with “■■■■” < you know what I mean
Go to the ■■■■ script, and in /src find c_main.lua, then find:
RegisterNUICallback("setPlayerTalking", function(data)
and replace line 50 to 62 with this:
RegisterNUICallback("setPlayerTalking", function(data)
voip.talking = tonumber(data.state);
if (voip.talking == 1) then
exports['scrubz_hud']:toggleVoiceActive(true)
setPlayerData(voip.serverId, "voip:talking", 1, true);
PlayFacialAnim(GetPlayerPed(PlayerId()), "mic_chatter", "mp_facial");
else
exports['scrubz_hud']:toggleVoiceActive(false)
setPlayerData(voip.serverId, "voip:talking", 0, true);
PlayFacialAnim(PlayerPedId(), "mood_normal_1", "facials@gen_male@base");
end
end)
Also if you want the hud to react to your proximity range find this in “c_Tokovoip.lua”
`function ■■■■■■■■.updateTokoVoipInfo(self, forceUpdate) – Update the top-left info``
Replace line 55 to 66 with this:
function ■■■■■■■■.updateTokoVoipInfo(self, forceUpdate) -- Update the top-left info
local info = "";
if (self.mode == 1) then
exports['scrubz_hud']:setVoiceLevel(2)
info = "Normal";
elseif (self.mode == 2) then
exports['scrubz_hud']:setVoiceLevel(1)
info = "Whispering";
elseif (self.mode == 3) then
exports['scrubz_hud']:setVoiceLevel(3)
info = "Shouting";
end
Now it should work, note that I use ■■■■■■■■ v. 1.2.5 so there is a chance your version is newer than mine and has changes made. Also make sure when you change the lines that you actually insert the “blacklisted word” because the forum has blocked the word.
Thank you bro you a g helped big time really thanks man we need more people like you in this community.
No worries
I told you yesterday that the ScrubzHud:Init
event handler needed to be triggered for the hud to show up…I just wasn’t willing to hold your hand in setting it up. We need people to learn some lua not more people to spoon feed others code.
Bro i don’t see what your problem is you release something your not willing to help people set it up & you act like it would have been a big issue to add a simple bit of code what Opax was kind enough to supply how is that a big issue lmfao its called being a decent kind person helping people & at the end of the day most resources get released ready to be used or come with support because most people what want to release something for people to use also want to be known as a good person and offer support not just release something & be like nahhh fuck you & because you don’t know how to lua i am not going to help you set it up lmfao
Lel. Okay.
Where do you think opax got the help to set up the hud?? Spolier: It was me. What’s the difference between the both of you?? I’M SO GLAD YOU ASKED!!! He actually listened to what I told him to do and for the most part got it working on his own instead of posting “oNlY tHe MeNu iS sHoWInG uP” despite being told that a specific event has to be triggered TWICE.
Except for the fact that I SPECIFICALLY STATED IN THE ORIGINAL POST…AND I QUOTE: " I am NOT providing any support for this". Maybe you just didn’t see that part.
It has nothing to do with how much lua you do or don’t know. Why then?? Good question!! I’ll refer you to point 2. But please remember, I did tell you TWICE what you needed to do (but I didn’t spell it out for you hooked on phonics style and I’m under no obligation to do so.) Again. Point 2.
Well…considering the fact that I don’t code on esx, don’t have esx files to test on, AND that I stated I wasn’t going to be giving support for this, idk what you expect of me. Do you expect people to download and set up an esx server just to add support for a framework they DONT use, when it’s literally ~15 lines of code (or there abouts) that can be EASILY added by the user DESPITE SAYING THAT THEY WEREN’T GOING TO ACTIVELY SUPPORT THIS RESOURCE IN THE FIRST PLACE??
So in summary, I’m a dick because I wouldn’t help you add a few lines of code that, in a super quick 30 seconds worth of searching, found MULTIPLE huds on the forums that use the same triggerevents that opax posted to get the values. I do see where you got that random event handler now. You got that from (ks_hud), but idk how you thought renaming an event used in a different hud to “scrubz:whatever” would work despite that event/code not existing in my resource, or how you missed the other tons of huds (I stopped counting at 6) that use the SAME way opax posted in their hud.
But hey! You’re right. I’m a dick. So why not go read the requirements 1 more time!
Pretty sure I’ve done something wrong aha , Installed the hud and got it working but after doing /showmenu and picking the colours and saving it , When I press the exit button the mouse stays on my screen ,Any one able to point me in the right direction to fix it