fivem lua I'm working on a fruit picking script but can't find the right animation
- User
fivem lua I'm working on a fruit picking script but can't find the right animation
- Assistant
To use a proper animation for your fruit picking script, you can use the following example code:
local fruitPickingDict = "amb@world_human_gardener_plant@female@base" -- Change female to male if needed local fruitPickingAnim = "base" -- This animation will resemble picking something up Citizen.CreateThread(function() while true do Citizen.Wait(0) -- Check if the player is at the right picking spot if IsPlayerNearFruitPickingLocation() then -- Request animation dictionary RequestAnimDict(fruitPickingDict) while not HasAnimDictLoaded(fruitPickingDict) do Citizen.Wait(10) end -- When the player presses E key, play the picking animation if IsControlJustReleased(0, 38) then -- E key is control 38 local playerPed = PlayerPedId() ClearPedTasks(playerPed) TaskPlayAnim(playerPed, fruitPickingDict, fruitPickingAnim, 8.0, -8.0, -1, 0, 0, false, false, false) -- You can add a delay, and fruit logic here local delay = 800 -- Change to the desired delay in milliseconds Citizen.Wait(delay) -- Add logic for successfully picking the fruit here ClearPedTasks(playerPed) end end end end) - User
I want an animation that reaches up similar to amb@prop_human_movie_bulb@idle_a
- Assistant
In that case, you can use the following animation dictionary and name:
local fruitPickingDict = "amb@prop_human_movie_bulb@base" local fruitPickingAnim = "base" Citizen.CreateThread(function() while true do Citizen.Wait(0) -- Check if the player is at the right picking spot if IsPlayerNearFruitPickingLocation() then -- Request animation dictionary RequestAnimDict(fruitPickingDict) while not HasAnimDictLoaded(fruitPickingDict) do Citizen.Wait(10) end -- When the player presses E key, play the picking animation if IsControlJustReleased(0, 38) then -- E key is control 38 local playerPed = PlayerPedId() ClearPedTasks(playerPed) TaskPlayAnim(playerPed, fruitPickingDict, fruitPickingAnim, 8.0, -8.0, -1, 0, 0, false, false, false) -- You can add a delay, and fruit logic here local delay = 1500 -- Change to the desired delay in milliseconds Citizen.Wait(delay) -- Add logic for successfully picking the fruit here ClearPedTasks(playerPed) end end end end)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.