Hi, i have a problem…
When i use an animation during a minerjob(WORLD_HUMAN_CONST_DRILL), after finishing the animation you’ll drop the drill.
In a job blip you will spawn a lot of drill…how can i fix/remove the drop of the object after the animation?
Hello, this is a friendly reminder because this is your first time creating a topic (or it has been a while since your last topic) in this category.
Please note that most of the support is provided by the Cfx.re community on a voluntary basis. We ask you to be patient; there is no guarantee we have a solution to your problem(s). To avoid unnecessary/duplicate topics, please browse the forums before creating a topic.
To improve your chances of your issue(s) being solved, please provide as much information as possible about the issue(s) you are having. Also —whenever possible— please use the template given to you when creating a topic.
When the animation ends, find the nearest drill and delete it:
local player = PlayerPedId()
local coords = GetEntityCoords(player)
local radius = 5.0
local prop = GetClosestObjectOfType(coords.x, coords.y, coords.z, radius,
GetHashKey('prop_tool_drill'), false, false, false)
if prop ~= 0 then
DeleteObject(prop)
end
This is my function for start animation on job blip…
i put your code in 3 different point to try it(------>) but the funcion GetClosestObjectOfType dosn’t work.
local function playAnimation(animationData)
local plyPed = PlayerPedId()
if(animationData.type == "scenario") then
TaskStartScenarioInPlace(plyPed, animationData.scenarioName, 0, true)
Citizen.Wait(animationData.scenarioDuration * 1000)
--------->
ClearPedTasks(plyPed)
elseif(animationData.type == "animation") then
while not HasAnimDictLoaded(animationData.animDict) do
RequestAnimDict(animationData.animDict)
Citizen.Wait(0)
end
local duration = animationData.animDuration * 1000
TaskPlayAnim(plyPed, animationData.animDict, animationData.animName, 4.0, 4.0, duration, 1, 1.0, 0, 0, 0)
Citizen.Wait(duration)
---------->
ClearPedTasks(plyPed)
end
------->