@@ -4353,8 +4353,6 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CElement* pElement, const SStri
43534353 CPed* pPed = static_cast <CPed*>(pElement);
43544354 if (pPed->IsSpawned ())
43554355 {
4356- // TODO: save their animation?
4357-
43584356 // Tell the players
43594357 CBitStream BitStream;
43604358 if (!blockName.empty () && !animName.empty ())
@@ -4367,6 +4365,9 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CElement* pElement, const SStri
43674365 if (pPed->IsChoking ())
43684366 pPed->SetChoking (false );
43694367
4368+ // Store anim data
4369+ pPed->SetAnimationData (SPlayerAnimData{blockName, animName, iTime, bLoop, bUpdatePosition, bInterruptable, bFreezeLastFrame, iBlend, bTaskToBeRestoredOnAnimEnd, GetTickCount64_ ()});
4370+
43704371 BitStream.pBitStream ->WriteString <unsigned char >(blockName);
43714372 BitStream.pBitStream ->WriteString <unsigned char >(animName);
43724373 BitStream.pBitStream ->Write (iTime);
@@ -4381,9 +4382,12 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CElement* pElement, const SStri
43814382 {
43824383 // Inform them to kill the current animation instead
43834384 BitStream.pBitStream ->Write ((unsigned char )0 );
4385+
4386+ // Clear anim data
4387+ pPed->SetAnimationData ({});
43844388 }
4385- m_pPlayerManager->BroadcastOnlyJoined (CElementRPCPacket (pPed, SET_PED_ANIMATION, *BitStream.pBitStream ));
43864389
4390+ m_pPlayerManager->BroadcastOnlyJoined (CElementRPCPacket (pPed, SET_PED_ANIMATION, *BitStream.pBitStream ));
43874391 return true ;
43884392 }
43894393 }
@@ -4405,14 +4409,17 @@ bool CStaticFunctionDefinitions::SetPedAnimationProgress(CElement* pElement, con
44054409 {
44064410 BitStream.pBitStream ->WriteString <unsigned char >(animName);
44074411 BitStream.pBitStream ->Write (fProgress );
4412+
4413+ pPed->SetAnimationProgress (fProgress );
44084414 }
44094415 else
44104416 {
44114417 // Inform them to kill the current animation instead
44124418 BitStream.pBitStream ->Write ((unsigned char )0 );
4419+ pPed->SetAnimationData ({});
44134420 }
4414- m_pPlayerManager->BroadcastOnlyJoined (CElementRPCPacket (pPed, SET_PED_ANIMATION_PROGRESS, *BitStream.pBitStream ));
44154421
4422+ m_pPlayerManager->BroadcastOnlyJoined (CElementRPCPacket (pPed, SET_PED_ANIMATION_PROGRESS, *BitStream.pBitStream ));
44164423 return true ;
44174424 }
44184425 }
@@ -4433,6 +4440,7 @@ bool CStaticFunctionDefinitions::SetPedAnimationSpeed(CElement* pElement, const
44334440 BitStream.pBitStream ->WriteString <unsigned char >(animName);
44344441 BitStream.pBitStream ->Write (fSpeed );
44354442
4443+ pPed->SetAnimationSpeed (fSpeed );
44364444 m_pPlayerManager->BroadcastOnlyJoined (CElementRPCPacket (pPed, SET_PED_ANIMATION_SPEED, *BitStream.pBitStream ));
44374445
44384446 return true ;
0 commit comments