GetPedAnimation: Difference between revisions
Jump to navigation
Jump to search
Al3grabMTA (talk | contribs) |
(getPedAnimation is client side only, that example was for server.) |
||
| Line 18: | Line 18: | ||
==Example== | ==Example== | ||
This example adds a command that allows you to copy the animation being used by another player using /copyanim theirName | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function CopyAnimation( | function CopyAnimation(theCommand, thePlayer) -- The Command Function | ||
if thePlayer then -- If a player name entered then | if thePlayer then -- If a player name entered then | ||
thePlayerToCopyFrom = getPlayerFromName(thePlayer) -- get player from his name | thePlayerToCopyFrom = getPlayerFromName(thePlayer) -- get player from his name | ||
Block,Anim = getPedAnimation(thePlayerToCopyFrom) -- get the player animation | Block, Anim = getPedAnimation(thePlayerToCopyFrom) -- get the player animation | ||
if Block then -- if got the animation successfully then | if Block then -- if got the animation successfully then | ||
setPedAnimation( | setPedAnimation(localPlayer, Block, Anim) -- set my animation the same | ||
outputChatBox("* Copied Successfully !" | outputChatBox("* Copied Successfully !") -- output chat message | ||
end | end | ||
else | else | ||
outputChatBox("* Please Enter a Player Name To Copy From !" | outputChatBox("* Please Enter a Player Name To Copy From !") -- if you didnt entered a player name , then output a chat box message | ||
end | end | ||
end | |||
addCommandHandler("copyanim",CopyAnimation) -- adding the Command Handler | addCommandHandler("copyanim", CopyAnimation) -- adding the Command Handler | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Ped_functions}} | {{Ped_functions}} | ||
[[Category:Needs Example]] | [[Category:Needs Example]] | ||
Revision as of 22:04, 27 November 2011
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
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
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnGround
- isPedReloadingWeapon
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle