manve1 Posted November 1, 2012 Share Posted November 1, 2012 When i add animation to "ped1" it doesn't show the animation when he is spawned: ped1 = createPed( 87, -285.9, 1206, 73.5 ) setElementDimension( ped1, 1 ) setPedAnimation( ped1, "STRIP", "PLY_CASH") Link to comment
DiSaMe Posted November 1, 2012 Share Posted November 1, 2012 Some data is not kept by MTA client when the ped is streamed out. It's MTA problem. If server sets animation immediately after creating the ped, he won't be streamed in for any player, therefore no one will see him performing the animation. To workaround this problem, use a client-side script which applies the animation when the ped triggers onClientElementStreamIn. Link to comment
Blaawee Posted November 1, 2012 Share Posted November 1, 2012 Syntax : setPedAnimation ( ped thePed [, string block=nil, string anim=nil, int time=-1, bool loop=true, bool updatePosition=true, bool interruptable=true, bool freezeLastFrame = true] ) ped1 = createPed( 87, -285.9, 1206, 73.5 ) setElementDimension( ped1, 1 ) setPedAnimation( ped1, "STRIP", "PLY_CASH" -1, true, false, true ) Link to comment
Smart. Posted November 1, 2012 Share Posted November 1, 2012 Syntax : setPedAnimation ( ped thePed [, string block=nil, string anim=nil, int time=-1, bool loop=true, bool updatePosition=true, bool interruptable=true, bool freezeLastFrame = true] ) ped1 = createPed( 87, -285.9, 1206, 73.5 ) setElementDimension( ped1, 1 ) setPedAnimation( ped1, "STRIP", "PLY_CASH" -1, true, false, true ) That's optional Link to comment
manve1 Posted November 1, 2012 Author Share Posted November 1, 2012 Some data is not kept by MTA client when the ped is streamed out. It's MTA problem. If server sets animation immediately after creating the ped, he won't be streamed in for any player, therefore no one will see him performing the animation. To workaround this problem, use a client-side script which applies the animation when the ped triggers onClientElementStreamIn. could you give me an example? because never used things might take long time to learn for me Link to comment
abu5lf Posted November 1, 2012 Share Posted November 1, 2012 setTimer ( setPedAnimation, 50, 1, ped1, "STRIP", "PLY_CASH" ) Link to comment
Anderl Posted November 1, 2012 Share Posted November 1, 2012 Some data is not kept by MTA client when the ped is streamed out. It's MTA problem. If server sets animation immediately after creating the ped, he won't be streamed in for any player, therefore no one will see him performing the animation. To workaround this problem, use a client-side script which applies the animation when the ped triggers onClientElementStreamIn. could you give me an example? because never used things might take long time to learn for me I've never been in such situations but I think it's this: addEventHandler( "onClientElementStreamIn", root, function() setPedAnimation( ped1, "STRIP", "PLY_CASH" ); end ) Client-side code, btw. Link to comment
DiSaMe Posted November 1, 2012 Share Posted November 1, 2012 Server: ped1 = createPed( 87, -285.9, 1206, 73.5 ) setElementDimension( ped1, 1 ) setElementID(ped1, "ped1") Client: ped1 = getElementByID("ped1") addEventHandler("onClientElementStreamIn", ped1, function() setPedAnimation( source, "STRIP", "PLY_CASH") end ) Link to comment
manve1 Posted November 2, 2012 Author Share Posted November 2, 2012 setTimer ( setPedAnimation, 50, 1, ped1, "STRIP", "PLY_CASH" ) i will use this, but thanx, i will have example whenever i create other peds now Link to comment
DiSaMe Posted November 2, 2012 Share Posted November 2, 2012 setTimer ( setPedAnimation, 50, 1, ped1, "STRIP", "PLY_CASH" ) i will use this, but thanx, i will have example whenever i create other peds now This won't work. Although waiting a short moment is likely to give the clients enough time to stream in the ped, it's still not guaranteed, and what's more, this only looks correct as long as the client is in streaming range when the ped is created. As I said, you need to apply the animation when the ped gets streamed in. 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