@@ -67,6 +67,7 @@ void CLuaPedDefs::LoadFunctions(void)
6767 CLuaCFunctions::AddFunction (" setPedCanBeKnockedOffBike" , SetPedCanBeKnockedOffBike);
6868 CLuaCFunctions::AddFunction (" setPedAnimation" , SetPedAnimation);
6969 CLuaCFunctions::AddFunction (" setPedAnimationProgress" , SetPedAnimationProgress);
70+ CLuaCFunctions::AddFunction (" setPedAnimationSpeed" , SetPedAnimationSpeed);
7071 CLuaCFunctions::AddFunction (" setPedWalkingStyle" , SetPedMoveAnim);
7172 CLuaCFunctions::AddFunction (" addPedClothes" , AddPedClothes);
7273 CLuaCFunctions::AddFunction (" removePedClothes" , RemovePedClothes);
@@ -150,6 +151,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
150151 lua_classfunction (luaVM, " setAnalogControlState" , " setPedAnalogControlState" );
151152 lua_classfunction (luaVM, " setAnimation" , " setPedAnimation" );
152153 lua_classfunction (luaVM, " setAnimationProgress" , " setPedAnimationProgress" );
154+ lua_classfunction (luaVM, " setAnimationSpeed" , " setPedAnimationSpeed" );
153155 lua_classfunction (luaVM, " setCameraRotation" , " setPedCameraRotation" );
154156 lua_classfunction (luaVM, " setControlState" , " setPedControlState" );
155157 lua_classfunction (luaVM, " warpIntoVehicle" , " warpPedIntoVehicle" );
@@ -2018,6 +2020,36 @@ int CLuaPedDefs::SetPedAnimationProgress(lua_State* luaVM)
20182020 return 1 ;
20192021}
20202022
2023+ int CLuaPedDefs::SetPedAnimationSpeed (lua_State* luaVM)
2024+ {
2025+ CClientEntity* pEntity;
2026+ SString strAnimName;
2027+ float fSpeed ;
2028+
2029+ CScriptArgReader argStream (luaVM);
2030+ argStream.ReadUserData (pEntity);
2031+ argStream.ReadString (strAnimName, " " );
2032+ argStream.ReadNumber (fSpeed , 1 .0f );
2033+
2034+ if (!argStream.HasErrors ())
2035+ {
2036+ if (!strAnimName.empty () && fSpeed >= 0 .0f && fSpeed <= 1 .0f )
2037+ {
2038+ if (CStaticFunctionDefinitions::SetPedAnimationSpeed (*pEntity, strAnimName, fSpeed ))
2039+ {
2040+ lua_pushboolean (luaVM, true );
2041+ return 1 ;
2042+ }
2043+ }
2044+ }
2045+ else
2046+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
2047+
2048+ // Failed
2049+ lua_pushboolean (luaVM, false );
2050+ return 1 ;
2051+ }
2052+
20212053int CLuaPedDefs::SetPedMoveAnim (lua_State* luaVM)
20222054{
20232055 // Verify the argument
0 commit comments