GetPedAnimationData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client function}} Gets the animation data of a player or ped that was set using setPedAnimation or blendPedAnimation. ==Syntax== <syntaxhighlight lang="lua"> ... getPedAnimationData (...)
 
m (Function has been disabled.)
 
(16 intermediate revisions by 10 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
 
{{Disabled}}
Gets the animation data of a player or ped that was set using [[setPedAnimation]] or [[blendPedAnimation]].
This function is used to return the animation data of a [[player]] or [[ped]] that was set using [[setPedAnimation]].


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
... getPedAnimationData ( ped thePed, string dataType )
string getPedAnimationData ( ped thePed )
</syntaxhighlight>
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''thePed:''' the player or ped you want to get the animation data of.
*'''thePed:''' the player or ped you want to get the animation data of.
*'''dataType:''' A string representing the type of data you want to retrieve:


==Data-types==
===Returns===
*'''name:''' string - name of animation.
Returns 2 <!-- Returns a string [[table]] -->[[string]]s containing information about [[animations]]. These keys are present below <!-- in the table --> :
*'''blockName:''' string - name of animation block.
*'''name:''' string - name of the animation
*'''loop:''' boolean - looping.
*'''block_name:''' string - name of animation block
*'''updatePosition:''' boolean - updating position.
<!-- For some reason it doesn't output these *'''loop:''' boolean - is animation looping?
*'''interruptable:''' boolean - interruptable.
*'''update_position:''' boolean - updating position
*'''time:''' float - duration.
*'''interruptible:''' boolean - is animation interruptible?
*'''startTime:''' float - starting point.
*'''time:''' float - duration of the animation
*'''finished:''' boolean - finished playing.
*'''start_time:''' float - starting point
*'''speed:''' float - speed.
*'''finished:''' boolean - has animation finished playing?
*'''blendSpeed:''' float - blending speed.
*'''speed:''' float - speed
*'''blend_speed:''' float - blending speed -->


===Returns===
===Example===
Returns various arguments depending on the 'dataType' specified.
This example adds a command to get the local player [[animations | animation]] data.
<syntaxhighlight lang="lua">function animData()
    local data = getPedAnimationData(localPlayer)
    if data then
          outputChatBox(data)
    else
          outputChatBox("Sorry, but you're not doing thing!")
    end
end
addCommandHandler("getAnimData",animData)
</syntaxhighlight>


==Example==
==Requirements==
{{Requirements|n/a|1.0.1|}}


==See Also==
==See Also==
{{Ped_functions}}
{{Client ped functions}}

Latest revision as of 17:09, 6 July 2016

Dialog-warning.png Function has been disabled.

This function is used to return the animation data of a player or ped that was set using setPedAnimation.

Syntax

string getPedAnimationData ( ped thePed )

Required Arguments

  • thePed: the player or ped you want to get the animation data of.

Returns

Returns 2 strings containing information about animations. These keys are present below  :

  • name: string - name of the animation
  • block_name: string - name of animation block

Example

This example adds a command to get the local player animation data.

function animData()
     local data = getPedAnimationData(localPlayer)
     if data then
          outputChatBox(data)
     else
          outputChatBox("Sorry, but you're not doing thing!")
     end
end
addCommandHandler("getAnimData",animData)

Requirements

Minimum server version n/a
Minimum client version 1.0.1

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.0.1" />

See Also