[Release] Hunger/Thirst HUD V0.3.3 (Added inventory and food shops)

How to fix the bug with the fuel ? I have FRFuel 1.0.1v and for some player the Fuel don’t work since I have the hunger and thirst bar

For all people who have the problem when you press enter to buy ou have to replace the vdk inv, by this one : https://github.com/ldlac/foodhud_externals

Because he changed some line and now for me all works correctly when i press enter or when i drink etc…

Yes it is weird, Sometime FrFuel can’t load correctly. I’m not sure if it’s coming from me or from FrFuel because my script is able to load everytime. And it’s kind of randomly, tested it 10 times and frfuel failed only one time to load

New version updated for foodhud_externals. The bug of mysql datareader should be fixed.

Ok I modified something in frfuel base script, I think the problem is from him. On 20 try, works all the time… If you could try on your side! :slight_smile:

I have inject modified.sql into the database I replaced the vdk_inventory folder and place the gb_foodshops folder in resource then I add it into citmp-server. When I run the server I have no bar display, stores are available but a MYSQL error appears when I want to buy how made?

Hey Draz, im trying to use your script, can you help me out? How would I go about doing a new item for use with the menu, im trying this but it doesnt work, what am I doing wrong?

function use(item)
    if (ITEMS[item].quantity - 1 >= 0) then
        -- Nice var swap for nothing
        TriggerEvent("player:looseItem", item, 1)
        TriggerServerEvent("item:updateQuantity", 1, item)
        -- Calling the Hunger/Thirst
        if ITEMS[item].type == 2 then
            TriggerEvent("food:eat", ITEMS[item])
        elseif ITEMS[item].type == 1 then
            TriggerEvent("food:drink", ITEMS[item])
		elseif ITEMS[item].type == 6 then
            TriggerEvent("food:drug", ITEMS[item])
        else
 --           -- Any other type? Drugs??????
        end
    end
end

The event “food:drug” doesn’t exist in foodhud. If you created it on your side, it’s all good. you should simply call what you want in the

		elseif ITEMS[item].type == 6 then
            -- Do things here like give hp, start the effect of drugs
        else

The drug effect have been added by someone on the github, I merged his addition, try it out :wink:

No bar display : Have you installed the main resource foodhud?

Can you detail the MySQL error. Be sure that everything is configured. Same names. Same id. Right types.

Yea, I know that, but I just put it up as an example, however I tried doing like you said but it still doesnt work for some reason :S take a look

function use(item)
    if (ITEMS[item].quantity - 1 >= 0) then
        -- Nice var swap for nothing
        TriggerEvent("player:looseItem", item, 1)
        TriggerServerEvent("item:updateQuantity", 1, item)
        -- Calling the Hunger/Thirst
        if ITEMS[item].type == 2 then
            TriggerEvent("food:eat", ITEMS[item])
        elseif ITEMS[item].type == 1 then
            TriggerEvent("food:drink", ITEMS[item])
		elseif ITEMS[item].type == 6 then
            GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL50"), 1, true, true)
        else
 --           -- Any other type? Drugs??????
        end
    end
end

And the type of your “new item” is 6 in the DB and in the lua file?

I simply put it in the database with the ID, but now that you say it, what lua file do I have to put it in aswell?

Watch the file gb_foodshops / foodGUI.lua

For the bar, it works well, but it is always at the time to buy that its blocked, I put you the error image. I add the same identifier and the same type and value …

Hmm yes, in fact, you just want to use them so you don’t need to add them to gb_foodshops. It… should works normally.
Can you screenshot the items you have in db?

Does anyone know how to solve it?

Yea sure, heres a screenie

It is really weird though, cause logically it would work, but now I just did a simple test like this:

function use(item)
    if (ITEMS[item].quantity - 1 >= 0) then
        -- Nice var swap for nothing
        TriggerEvent("player:looseItem", item, 1)
        TriggerServerEvent("item:updateQuantity", 1, item)
        -- Calling the Hunger/Thirst
        if ITEMS[item].type == 2 then
            TriggerEvent("food:eat", ITEMS[item])
        elseif ITEMS[item].type == 1 then
        --    TriggerEvent("food:drink", ITEMS[item])
		GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("WEAPON_PISTOL50"), 1, true, true)
        else
 --           -- Any other type? Drugs??????
        end
    end
end

and it did in fact give me the weapon, hmm…

Morphine type = 1 in db
And you are comparing it to 6 in the code :slight_smile: !

omg duudee, haha I just realised that l!! so stupid hahaha

Changed the type to 6 and it works like a charm now

1 Like

If you are adding more content like this you can send Pull Requests on the Github and I will merge your code to the main branch! :slight_smile: