Fabio132 Posted April 11, 2020 Share Posted April 11, 2020 Hello, Ragemp Community I need help by sync animations. Pls send me some example's Thank you For helping! Link to comment Share on other sites More sharing options...
PanaFive Posted April 14, 2020 Share Posted April 14, 2020 (edited) Client-side: mp.events.add({ 'entityStreamIn' : (entity) => { if(entity.type == 'player') { if (entity.hasVariable("animData")) { const value = entity.getVariable("animData"); if (null != value) { const anim = value.split("%"); loadAnimDict(anim[0], function() { mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(anim[0], anim[1], 1, 0, -1, parseInt(anim[2]), 1, !1, !1, !1) }) } } } }, }); mp.events.addDataHandler("animData", function(a, b) { if (0 !== a.handle) if (null != b) { const c = b.split("%"); loadAnimDict(c[0], function() { mp.players.exists(a) && 0 !== a.handle && (a.clearTasksImmediately(), a.taskPlayAnim(c[0], c[1], 1, 0, -1, parseInt(c[2]), 1, !1, !1, !1)) }) } //else a.clearTasksImmediately() }); function loadAnimDict(a, b) { if (mp.game.streaming.hasAnimDictLoaded(a)) return void b(); mp.game.streaming.requestAnimDict(a); let c = setInterval(function() { mp.game.streaming.hasAnimDictLoaded(a) && (clearInterval(c), b()) }, 100) } Server-side: player.playAnimation(dist, name, speed, flag); player.setVariable("animData", `${dist}%${name}%${flag}`); Stop animation: player.playAnimation("rcmcollect_paperleadinout@","kneeling_arrest_get_up", 1, 33); player.setVariable("animData", null); Edited April 14, 2020 by PanaFive 4 Link to comment Share on other sites More sharing options...
Fabio132 Posted April 18, 2020 Author Share Posted April 18, 2020 Am 14.4.2020 um 13:50 schrieb PanaFive: Client-side: mp.events.add({ 'entityStreamIn' : (entity) => { if(entity.type == 'player') { if (entity.hasVariable("animData")) { const value = entity.getVariable("animData"); if (null != value) { const anim = value.split("%"); loadAnimDict(anim[0], function() { mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(anim[0], anim[1], 1, 0, -1, parseInt(anim[2]), 1, !1, !1, !1) }) } } } }, }); mp.events.addDataHandler("animData", function(a, b) { if (0 !== a.handle) if (null != b) { const c = b.split("%"); loadAnimDict(c[0], function() { mp.players.exists(a) && 0 !== a.handle && (a.clearTasksImmediately(), a.taskPlayAnim(c[0], c[1], 1, 0, -1, parseInt(c[2]), 1, !1, !1, !1)) }) } //else a.clearTasksImmediately() }); function loadAnimDict(a, b) { if (mp.game.streaming.hasAnimDictLoaded(a)) return void b(); mp.game.streaming.requestAnimDict(a); let c = setInterval(function() { mp.game.streaming.hasAnimDictLoaded(a) && (clearInterval(c), b()) }, 100) } Server-side: player.playAnimation(dist, name, speed, flag); player.setVariable("animData", `${dist}%${name}%${flag}`); Stop animation: player.playAnimation("rcmcollect_paperleadinout@","kneeling_arrest_get_up", 1, 33); player.setVariable("animData", null); where do I have to put the server-side in my script where it will be played or in a single script? Link to comment Share on other sites More sharing options...
Maylo Posted November 19, 2020 Share Posted November 19, 2020 В 14.04.2020 в 14:50, PanaFive сказал: Client-side: mp.events.add({ 'entityStreamIn' : (entity) => { if(entity.type == 'player') { if (entity.hasVariable("animData")) { const value = entity.getVariable("animData"); if (null != value) { const anim = value.split("%"); loadAnimDict(anim[0], function() { mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(anim[0], anim[1], 1, 0, -1, parseInt(anim[2]), 1, !1, !1, !1) }) } } } }, }); mp.events.addDataHandler("animData", function(a, b) { if (0 !== a.handle) if (null != b) { const c = b.split("%"); loadAnimDict(c[0], function() { mp.players.exists(a) && 0 !== a.handle && (a.clearTasksImmediately(), a.taskPlayAnim(c[0], c[1], 1, 0, -1, parseInt(c[2]), 1, !1, !1, !1)) }) } //else a.clearTasksImmediately() }); function loadAnimDict(a, b) { if (mp.game.streaming.hasAnimDictLoaded(a)) return void b(); mp.game.streaming.requestAnimDict(a); let c = setInterval(function() { mp.game.streaming.hasAnimDictLoaded(a) && (clearInterval(c), b()) }, 100) } Server-side: player.playAnimation(dist, name, speed, flag); player.setVariable("animData", `${dist}%${name}%${flag}`); Stop animation: player.playAnimation("rcmcollect_paperleadinout@","kneeling_arrest_get_up", 1, 33); player.setVariable("animData", null); Thank you so much bro Link to comment Share on other sites More sharing options...
Henning222 Posted February 27 Share Posted February 27 Since last ragemp update you need to change the code from PanaFive a little bit. On clientside use this dataHandler instead of PanaFive Datahandler: mp.events.addDataHandler('animData', (a, b) => { if (0 === a.handle) return; if (!b) { a.clearTasksImmediately(); return; } const c = b.split('%'); loadAnimDict(c[0], function () { if (mp.players.exists(a) && (0 !== a.handle)) { a.clearTasksImmediately(); a.taskPlayAnim( c[0], c[1], 1, 0, -1, parseInt(c[2]), 1, !1, !1, !1, ); } }); }); Since xday wrote on discord that he will look into it, its possible that PanaFives Version is working tomorrow again. Link to comment Share on other sites More sharing options...
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