getPedAnimation | Multi Theft Auto: Wiki Skip to content

getPedAnimation

Client-side
Server-side
Shared

Pair: setPedAnimation

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


Gets the animation of a player or ped that was set using setPedAnimation.

Note

Use getPedTask to monitor what movements the player is currently doing.

OOP Syntax Help! I don't understand this!

  • Method:ped:getAnimation(...)

Syntax

string,​ string,​ int,​ int,​ bool,​ bool,​ bool,​ int,​ bool getPedAnimation ( ped thePed )
Required Arguments
  • thePed: the player or ped you want to get the animation of.

Returns

  • string: value1
  • string: value2
  • int: value3
  • int: value4
  • bool: value5
  • bool: value6
  • bool: value7
  • int: value8
  • bool: value9

The function returns 9 values in the same order as required by setPedAnimation :

Code Examples

shared

This example adds a command that allows you to copy the animation being used by another player using /copyanim theirName

function CopyAnimation(theCommand, thePlayer) -- The Command Function
if thePlayer then -- If a player name entered then
thePlayerToCopyFrom = getPlayerFromName(thePlayer) -- get player from his name
block, anim = getPedAnimation(thePlayerToCopyFrom) -- get the player animation
if block then -- if got the animation successfully then
setPedAnimation(localPlayer, block, anim) -- set my animation the same
outputChatBox("* Copied Successfully !") -- output chat message
end
else
outputChatBox("* Please Enter a Player Name To Copy From !") -- if you didnt entered a player name , then output a chat box message
end
end
addCommandHandler("copyanim", CopyAnimation) -- adding the Command Handler

See Also