Skip to content

Commit

Permalink
refactor(client): release anims
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon authored Jun 24, 2024
1 parent b412e68 commit 9566886
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions client/dead.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ local function playDeadAnimation()

if cache.vehicle then
if not IsEntityPlayingAnim(cache.ped, deadVehAnimDict, deadVehAnim, 3) then
lib.requestAnimDict(deadVehAnimDict, 5000)
TaskPlayAnim(cache.ped, deadVehAnimDict, deadVehAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(cache.ped, deadVehAnimDict, deadVehAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
end
elseif not IsEntityPlayingAnim(cache.ped, deadAnimDict, deadAnim, 3) then
lib.requestAnimDict(deadAnimDict, 5000)
TaskPlayAnim(cache.ped, deadAnimDict, deadAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(cache.ped, deadAnimDict, deadAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
end
end

Expand Down
8 changes: 4 additions & 4 deletions client/setdownedstate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ local LastStandCuffedAnim = 'dead_f'

local function playUnescortedLastStandAnimation()
if cache.vehicle then
lib.requestAnimDict(vehicleDict, 5000)
if not IsEntityPlayingAnim(cache.ped, vehicleDict, vehicleAnim, 3) then
TaskPlayAnim(cache.ped, vehicleDict, vehicleAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(cache.ped, vehicleDict, vehicleAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
end
else
local dict = not QBX.PlayerData.metadata.ishandcuffed and LastStandDict or LastStandCuffedDict
local anim = not QBX.PlayerData.metadata.ishandcuffed and LastStandAnim or LastStandCuffedAnim
lib.requestAnimDict(dict, 5000)
if not IsEntityPlayingAnim(cache.ped, dict, anim, 3) then
TaskPlayAnim(cache.ped, dict, anim, 1.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(cache.ped, dict, anim, 1.0, 1.0, -1, 1, 0, false, false, false)
end
end
end
Expand All @@ -27,13 +25,15 @@ local function playEscortedLastStandAnimation(ped)
if IsEntityPlayingAnim(ped, vehicleDict, vehicleAnim, 3) then
StopAnimTask(ped, vehicleDict, vehicleAnim, 3)
end
RemoveAnimDict(vehicleDict)
else
local dict = not QBX.PlayerData.metadata.ishandcuffed and LastStandDict or LastStandCuffedDict
local anim = not QBX.PlayerData.metadata.ishandcuffed and LastStandAnim or LastStandCuffedAnim
lib.requestAnimDict(dict, 5000)
if IsEntityPlayingAnim(ped, dict, anim, 3) then
StopAnimTask(ped, dict, anim, 3)
end
RemoveAnimDict(dict)
end
end

Expand Down

0 comments on commit 9566886

Please sign in to comment.