setPedAnimationSpeed | Multi Theft Auto: Wiki Skip to content

setPedAnimationSpeed

Client-side
Server-side
Shared

Manual Review Required

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


Sets the speed of a currently running animation for a particular player or ped.

Important

Warning: Setting speed higher than 1 can cause issues with some animations.

OOP Syntax Help! I don't understand this!

  • Method:ped:setAnimationSpeed(...)

Syntax

bool setPedAnimationSpeed ( ped thePed, [ string anim = "", float speed = 1.0 ] )
Required Arguments
  • thePed: the player or ped you want to change animation speed of.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • anim (default: ""): the animation name it will affect.
  • speed (default: 1.0): a float containing the speed between 0.0–1.0 you want to apply to the animation. This limitation may be adjusted in the future, so do not provide speeds outside this boundary. The limit is now 0.0 to 10.0.

Returns

  • bool: value

Returns true if successful, false otherwise.

Code Examples

shared

In this example we give the animation of dancing to the player and after 5 seconds it becomes 0.2s slower.

addCommandHandler('dance',
function( player, cmd )
setPedAnimation( player, 'DANCING', 'DAN_Down_A', -1 )
setTimer(function(plr)
if isElement(plr) then setPedAnimationSpeed( plr, 'DAN_Down_A', 0.2 ) end
end,5000,1,player)
end
)

See Also