SetPedAnimationSpeed: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 16: | Line 16: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
*'''anim:''' the animation name it will affect. | *'''anim:''' the animation name it will affect. | ||
*'''speed:''' 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.'' | *'''speed:''' 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.'' {{New feature/item|3.0158|1.5.7|20395|The limit is now 0.0 to 10.0.}} {{Warning|Setting '''speed''' higher than '''1''' can cause issues with some animations.}} | ||
===Returns=== | ===Returns=== | ||
Line 28: | Line 28: | ||
function( player, cmd ) | function( player, cmd ) | ||
setPedAnimation( player, 'DANCING', 'DAN_Down_A', -1 ) | setPedAnimation( player, 'DANCING', 'DAN_Down_A', -1 ) | ||
setTimer(function(plr) | |||
setTimer(function() | if isElement(plr) then setPedAnimationSpeed( plr, 'DAN_Down_A', 0.2 ) end | ||
setPedAnimationSpeed( | end,5000,1,player) | ||
end,5000,1) | |||
end | end | ||
) | ) |
Latest revision as of 06:55, 17 December 2023
Sets the speed of a currently running animation for a particular player or ped.
Syntax
bool setPedAnimationSpeed ( ped thePed [, string anim = "", float speed = 1.0 ] )
OOP Syntax Help! I don't understand this!
- Method: ped:setAnimationSpeed(...)
Required Arguments
Optional Arguments
- anim: the animation name it will affect.
- speed: 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.
Warning: Setting speed higher than 1 can cause issues with some animations. |
Returns
Returns true if successful, false otherwise.
Example
Click to collapse [-]
ServerIn 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
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle