GetPedAnimation

From Multi Theft Auto: Wiki
Revision as of 14:30, 27 November 2011 by Al3grabMTA (talk | contribs) (→‎Example)
Jump to navigation Jump to search

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.

Syntax

string string getPedAnimation ( ped thePed )

Required Arguments

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

Returns

Returns two strings: the first is the name of the block, the second is the name of the animation. Returns false if there was an error or if the ped is not doing an animation.

Example

Click to collapse [-]
Server
function CopyAnimation(Me,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(Me,Block,Anim) -- set my animation the same
			outputChatBox("* Copied Successfully !",Me)	-- output chat message
		end
	else	
		outputChatBox("* Please Enter a Player Name To Copy From !",Me)	-- if you didnt entered a player name , then output a chat box message
	end
	end
addCommandHandler("copyanim",CopyAnimation) --  adding the Command Handler

~~~~

See Also