From bd91dd81aba4d7c8bcb7c2fbc9b3e6148eb9ca85 Mon Sep 17 00:00:00 2001 From: JnKTechstuff <7122547+JnKTechstuff@users.noreply.github.com> Date: Thu, 2 Feb 2023 21:22:51 -0500 Subject: [PATCH] refactor(client/progressbar): better animation cancelling (#208) --- resource/interface/client/progress.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/resource/interface/client/progress.lua b/resource/interface/client/progress.lua index 902161fb2..c1abaa397 100644 --- a/resource/interface/client/progress.lua +++ b/resource/interface/client/progress.lua @@ -68,12 +68,8 @@ local function startProgress(data) TaskPlayAnim(cache.ped, data.anim.dict, data.anim.clip, data.anim.blendIn or 3.0, data.anim.blendOut or 1.0, data.anim.duration or -1, data.anim.flag or 49, data.anim.playbackRate or 0, data.anim.lockX, data.anim.lockY, data.anim.lockZ) RemoveAnimDict(data.anim.dict) - - data.anim = true elseif data.anim.scenario then TaskStartScenarioInPlace(cache.ped, data.anim.scenario, 0, data.anim.playEnter ~= nil and data.anim.playEnter or true) - - data.anim = true end end @@ -129,10 +125,6 @@ local function startProgress(data) Wait(0) end - if data.anim then - ClearPedTasks(cache.ped) - end - if data.prop then local n = #data.prop for i = 1, n > 0 and n or 1 do @@ -143,6 +135,13 @@ local function startProgress(data) end end end + + if data.anim then + StopAnimTask(cache.ped, data.anim.dict, data.anim.clip, 1.0) + Wait(0) -- This is needed here otherwise the StopAnimTask is cancelled + elseif data.anim.scenario then + ClearPedTasks(cache.ped) + end playerState.invBusy = false local cancel = progress == false