Jump to content

Freeze after talk animation


TheCapn

Recommended Posts

Posted

Hello guys,

I'm using an animation when a player talks, but at the end of the animation the player keeps his arms straight long to his body, and move like a robot. I have to "fire" in order to break this freeze.

Do you know how can I fix it ?

Here's my code

  
function sayHandler( message, msgType ) 
 ... 
        setPedAnimation( source, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
    ... 
end 
addEventHandler( "onPlayerChat", getRootElement(), sayHandler ) 
  

Posted

you can use setTimer(removeEventHandler('onPlayerChat' ) ,

and return it after if you want it , but i think it will cause lag,

why you need animation for this , just use image over player head if he talks , better

Posted

see here the function

time: how long the animation will run for in milliseconds.

you can use setTimer , after some time use CancelEvent , or removeEventHandler,

Posted
function sayHandler( message, msgType ) 
 ... 
        local AnimationDuration = 1000   -- Measure your animation's duration in miliseconds 
        setPedAnimation( source, "PED", "IDLE_CHAT", 1, false, true, true, true, false ) 
        setTimer(setPedAnimation,AnimationDuration,1,source) 
    ... 
end 
addEventHandler( "onPlayerChat", getRootElement(), sayHandler ) 

You don't have to use the variable AnimationDuration, I did it just to point it out. Anyway, to stop the player's animation, you use setPedAnimation without specifying animation block and name.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...