GetPedAnimationData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (→‎Example: Forgot the var)
Line 28: Line 28:
This example adds a command to get the local player [[animations | animation]] data.  
This example adds a command to get the local player [[animations | animation]] data.  
<syntaxhighlight lang="lua">function animData()
<syntaxhighlight lang="lua">function animData()
    local data = getAnimationData(localPlayer)
     if data then
     if data then
           outputChatBox(data)
           outputChatBox(data)
Line 37: Line 38:
addCommandHandler("gAD",animData)
addCommandHandler("gAD",animData)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
==Requirements==
{{Requirements|n/a|1.0.1|}}
{{Requirements|n/a|1.0.1|}}

Revision as of 20:12, 20 September 2012

Dialog-information.png This article needs checking.

Reason(s): Still missing in 1.3, getPedTask monitors the player, but you can't get animation table --Ransom 03:14, 1 September 2012 (UTC)

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 = getAnimationData(localPlayer)
     if data then
          outputChatBox(data)
     else
          outputChatBox("Sorry, but you're not doing thing!")
     end
end
addCommandHandler("getAnimData",animData)
addCommandHandler("gAD",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