Jump to content

Animations


manve1

Recommended Posts

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
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
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
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
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

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
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

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...