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.
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.
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.
Hey !
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 :
You create an item to be usable (sandwich in our case) by doing the following : in [qb-smallresources/server/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.
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.
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.
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.
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…
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,