SetPedAnimationProgress: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
Sets the current animation progress of a player or ped.
Sets the current animation progress of a player or ped.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setPedAnimationProgress ( ped thePed, string anim, float progress)
bool setPedAnimationProgress ( ped thePed [, string anim, float progress ] )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[ped]]:setAnimationProgress}}


===Required Arguments===
===Required Arguments===
*'''thePed:''' the player or ped you want to change animation progress.
*'''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.
===Optional Arguments===
*'''anim:''' the animation name currently applied to ped, if not supplied, the animation will stop
*'''progress:''' current animation progress you want to apply, value from 0.0 to 1.0, if not supplied will default to 0.0


===Returns===
===Returns===
Returns ''true'' if succesful, ''false'' otherwise.
Returns ''true'' if successful, ''false'' otherwise.


==Example==  
==Example==
 
This example creates a ped, apply animation to it, and "freeze" the animation at half of overall animation time.
<section name="Server" class="server" show="true">
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


function makePed()
function makePed( )
     local ped1 = createPed(56, 1, 1, 4)
     local ped1 = createPed( 56, 1, 1, 4 )
     setPedAnimation( ped1, "SMOKING", "M_SMKSTND_LOOP")
     setPedAnimation( ped1, "SMOKING", "M_SMKSTND_LOOP" )
     setTimer ( animRender, 50, 1, ped1 )
     setTimer ( animRender, 50, 1, ped1 )
end
end
addCommandHandler("makemyped", makePed)
addCommandHandler( "makemyped", makePed )
</syntaxhighlight>
</syntaxhighlight>
</section>
 
==Issues==
{{Deprecated items|3.0141|1.4 r6826|{{Issues|{{Issue|8461|setPedAnimationProgress() clientside always sets animation progress to 0}}}}}}


==See Also==
==See Also==
{{Ped_functions}}
{{Ped_functions}}
[[ru:setPedAnimationProgress]]

Latest revision as of 00:45, 8 July 2018

Sets the current animation progress of a player or ped.

Syntax

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

OOP Syntax Help! I don't understand this!

Method: ped:setAnimationProgress(...)


Required Arguments

  • thePed: the player or ped you want to change animation progress.

Optional Arguments

  • anim: the animation name currently applied to ped, if not supplied, the animation will stop
  • progress: current animation progress you want to apply, value from 0.0 to 1.0, if not supplied will default to 0.0

Returns

Returns true if successful, false otherwise.

Example

This example creates a ped, apply 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 )

Issues

BEFORE VERSION 1.4 r6826 :
Issue ID Description
#8461 setPedAnimationProgress() clientside always sets animation progress to 0

See Also