Advise support player bout food items

Hi I don’t know much about prop food items or animations, for player thirst & hunger that are bought.
I would like to match what players buy for example, food items when they buy an item for example item icon shows chocolate bar in game, they get Choco bar prop.
In my version I get given by default a burger for all my items, and for the drinking part its again same situation but with a bottle even though icons shows bear or cocktail.

If have no idea about this type of thing and where to look.
Using QBCore Framework.

1 Like

https://gtahash.ru/
heres site to see all props in GTA, in esx basic needs you can change the animations but not sure about QBcore

1 Like

thanks

1 Like

Hello, since I have just contacted qbcore, I still don’t know much about it. So I want to ask, how should I add more food, with edible functions and edible animations?

I’m trying to work it out myself been playing around with something’s.
Still not worked it out I keep breaking it. Sorry, I could not find any resources or guides online other.

Do you know how to make food edible?

1 Like

That’s the part I’m trying to work out it’s to do with replacing the prop it pulls of player inventory out then it does it’s animation you might be on another framework though.

I mean, I want the added food to restore a certain state value after use

Instead of replacing the props in their hands

Hey :slightly_smiling_face: !
I’m far from a QBcore expert as I just started to use it to see what it can do. I was thinking to myself, that trying to see if I can find what you are looking for would be an oportunity for me to improve my understanding of the framework ^^.

Based on the code that I went through I would say that :

  1. You create an item to be usable (sandwich in our case) by doing the following :
    in [qb-smallresources/server/consumables.lua]

  2. Defining what to do when you use the item :
    in [qb-smallresources/client/consumables.lua]


    We can see line 367 is where the animation is triggered by called an event and giving him the animation name as arg1.

  3. And here is where the animations and props are defined and by extension where our event that was triggered in the previous step will fetch for thoses I think :
    in [[standalone]/dpemotes/Client.AnimationList.lua]


    And the prop you were looking for is line 1309 (for the eating animation in this example)

So If I were you, I’ll try to create multiple animations in the [AnimationList.lua]:

  • [“eatBurger”]
  • ["eatIceCream]

    And changing the prop (and even the animation if you want) in the AnimationOptions attributes.

And then you can create multiple events in the [consumables.lua] client or keep the Eat Event alone and add a conditionnal structure based on the itemName he receives.

Peace

2 Likes

Thanks now i see I have someone look at this with more expertise he might post more on this subject.
OMG it was right their the entire time I was looking in the wrong files.

1 Like

did u find out how to do this? If not you need to get the prop name of the animation say for instance for the chocolate you need chocbar animation name and then you go to basicneeds server. lua and copy and paste the bread one that is already in there and add a new line for your chocolate bar. Hope this helps.

1 Like

Hey guys, Its all in qb-smallresources,
edit the consumables.lua in the server folder… you will see this…

QBCore.Functions.CreateUseableItem(“sandwich”, function(source, item)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if Player.Functions.RemoveItem(item.name, 1, item.slot) then
TriggerClientEvent(“consumables:client:Eat”, src, item.name)
end
end)

copy and paste it and then just change sandwich to some other food you want… same goes for drinks.

Then you also need to add it to config in smallresources…

ConsumeablesEat = {
[“sandwich”] = math.random(35, 54),

Like so… just change sandwich to something else after copy and pasting.
you can change the numbers for how much it fills you up etc…

then add the item into shared items in qbcore.
set item as useable and shouldclose true.

I have followed your reasoning but it does not make me animations when I use the object

1 Like

I have followed your reasoning but it does not make me animations when I use the object :c

Yeah the animations end up getting mixed up. so like i eat a sandwich and the animation is a choc bar. I have changed the prop to ego_choc_prop and the name of the item in animations but its getting mixed up.

check the animation names in dpemotes, well make sure you are using dpemotes 1st, get the latest version. I have this developed and fully working in a live server,

1 Like

whats the code for attaching the props?

Boii developments released a free script with props and food which you may be interested in, it looks pretty good.

1 Like

Can you post the link?? How are you going to leave us hanging like that.