SetPedAnimationProgress: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 22: Line 22:
This example creates a ped, aplly animation to it, and "freeze" the animation at half of overall animation time.
This example creates a ped, aplly animation to it, and "freeze" the animation at half of overall animation time.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Progress = 0.5
function animRender( ped1 )
function animRender( ped1 )
         setPedAnimationProgress(ped1, "M_SMKSTND_LOOP", Progress)
         setPedAnimationProgress(ped1, "M_SMKSTND_LOOP", 0.5)
         setTimer ( animRender, 50, 1, ped1 )
         setTimer ( animRender, 50, 1, ped1 )
end
end

Revision as of 12:37, 15 August 2011

Sets the current animation progress of a player or ped.

Syntax

bool setPedAnimationProgress ( ped thePed, string anim, float progress)

Required Arguments

  • thePed: the player or ped you want to change animation progress.
  • anim: the animation name, currently applied to ped.
  • progress: current animation progress you want to apply, value from 0.0 to 1.0.

Returns

Returns true if succesful, false otherwise.

Example

Click to collapse [-]
Server

This example creates a ped, aplly animation to it, and "freeze" the animation at half of overall animation time.

function animRender( ped1 )
        setPedAnimationProgress(ped1, "M_SMKSTND_LOOP", 0.5)
        setTimer ( animRender, 50, 1, ped1 )
end

function makePed()
    local ped1 = createPed(56, 1, 1, 4)
    setPedAnimation( ped1, "SMOKING", "M_SMKSTND_LOOP")
    setTimer ( animRender, 50, 1, ped1 )
end
addCommandHandler("makemyped", makePed)

See Also