TheCapn Posted June 21, 2014 Share Posted June 21, 2014 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 ) Link to comment
Max+ Posted June 21, 2014 Share Posted June 21, 2014 well you can use setTimer to fix it , Link to comment
TheCapn Posted June 21, 2014 Author Share Posted June 21, 2014 And which function would I use in the setTimer ? Link to comment
Max+ Posted June 21, 2014 Share Posted June 21, 2014 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 Link to comment
TheCapn Posted June 21, 2014 Author Share Posted June 21, 2014 Well I want to play this animation. There is no function that could put back the normal standing of the player ? Link to comment
Max+ Posted June 21, 2014 Share Posted June 21, 2014 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, Link to comment
ADCX Posted June 21, 2014 Share Posted June 21, 2014 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now