Stealthy Serval Posted December 12, 2018 Share Posted December 12, 2018 Hey all, I'm trying to make it so when a player loads in it creates a ped of their character and sets an animation. Before, when I did this with the player rather than the ped, it worked, but was a little spotty (sometimes it applied the animation, sometimes you had to reconnect for it to work) so I thought using a ped would be better. But the animation isn't applying at all. I've tried adding a timer, and all that did was make the ped spawn later, still no animation. The ped is being brought to the appropriate dimension, and spawning properly. charPed[1] = createPed(getElementData(player,"char1skin"),1187,-2034.4,69.007,180) setElementDimension(charPed[1],getElementDimension(player)) setPedAnimation(charPed[1],"ped","seat_idle",-1,false) Again, it worked properly with the player, just not now. Any help would be appreciated! Link to comment
Moderators Patrick Posted December 12, 2018 Moderators Share Posted December 12, 2018 setTimer(setPedAnimation, 100, 1, charPed[1],"ped","seat_idle",-1,false) Use a little delay after createPed. Link to comment
Stealthy Serval Posted December 12, 2018 Author Share Posted December 12, 2018 5 minutes ago, Patrick2562 said: setTimer(setPedAnimation, 100, 1, charPed[1],"ped","seat_idle",-1,false) Use a little delay after createPed. Hey! So I did try that before posting, I used 500 initially for the time, and it didn't work, but for some reason using your 100 works. Any idea why this could be so I can avoid it later? Link to comment
Moderators Patrick Posted December 12, 2018 Moderators Share Posted December 12, 2018 14 minutes ago, Stealthy Serval said: Hey! So I did try that before posting, I used 500 initially for the time, and it didn't work, but for some reason using your 100 works. Any idea why this could be so I can avoid it later? I have no idea. Link to comment
Tommy. Posted December 12, 2018 Share Posted December 12, 2018 (edited) Try this: charPed[1] = createPed(getElementData(player,"char1skin"),1187,-2034.4,69.007,180) setElementDimension(charPed[1],getElementDimension(player)) setTimer(function () setPedAnimation (charPed[1], "ped", "SEAT_idle", -1, true, false, false ) end, 100, 1) EDIT: here it works Edited December 12, 2018 by Tommy. 1 Link to comment
Moderators Patrick Posted December 12, 2018 Moderators Share Posted December 12, 2018 1 hour ago, Tommy. said: Try this: charPed[1] = createPed(getElementData(player,"char1skin"),1187,-2034.4,69.007,180) setElementDimension(charPed[1],getElementDimension(player)) setTimer(function () setPedAnimation (charPed[1], "ped", "SEAT_idle", -1, true, false, false ) end, 100, 1) EDIT: here it works setTimer(function () setPedAnimation (charPed[1], "ped", "SEAT_idle", -1, true, false, false ) end, 100, 1) and setTimer(setPedAnimation, 100, 1, charPed[1], "ped", "SEAT_idle", -1, true, false, false) are same. Link to comment
Tommy. Posted December 12, 2018 Share Posted December 12, 2018 15 minutes ago, Patrick2562 said: setTimer(function () setPedAnimation (charPed[1], "ped", "SEAT_idle", -1, true, false, false ) end, 100, 1) and setTimer(setPedAnimation, 100, 1, charPed[1], "ped", "SEAT_idle", -1, true, false, false) are same. As he said it did not work I gave him a solution that works with me Link to comment
Moderators Patrick Posted December 12, 2018 Moderators Share Posted December 12, 2018 9 minutes ago, Tommy. said: As he said it did not work I gave him a solution that works with me "but for some reason using your 100 works" 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