This commit is contained in:
2021-04-06 19:20:56 +02:00
parent be65865585
commit 6463114ccf

View File

@@ -49,11 +49,19 @@
*/ */
setInterval(() => { setInterval(() => {
if (mp.players.local.getVariable("AnimationData")) {
blockInput = true;
} else {
blockInput = false;
}
mp.players.forEachInStreamRange( mp.players.forEachInStreamRange(
(player) => { (player) => {
if (!player.getVariable("AnimationData")) { if (!player.getVariable("AnimationData")) {
return; return;
} }
if (player != mp.players.local)
mp.game.wait(200);
let index = mp.game.joaat(player.getVariable("AnimationData")); let index = mp.game.joaat(player.getVariable("AnimationData"));
let currentAnim = animationSyncData.animations[index]; let currentAnim = animationSyncData.animations[index];
@@ -64,13 +72,9 @@
loadAnimDict(animDict, function () { loadAnimDict(animDict, function () {
mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 8, 1, duration, parseInt(flag), 0, !1, !1, !1) mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 8, 1, duration, parseInt(flag), 0, !1, !1, !1)
}); });
if (player == mp.players.local) {
blockInput = true;
}
} else if (!loop && player.isPlayingAnim(animDict, animName, 3)) { } else if (!loop && player.isPlayingAnim(animDict, animName, 3)) {
let a = setInterval(function () { let a = setInterval(function () {
if (player == mp.players.local) { if (player == mp.players.local) {
blockInput = false;
mp.events.callRemote("CLIENT:ClearAnimationData", player); mp.events.callRemote("CLIENT:ClearAnimationData", player);
} }
clearInterval(a); clearInterval(a);
@@ -82,7 +86,6 @@
mp.events.addDataHandler("AnimationData", (entity: PlayerMp, string) => { mp.events.addDataHandler("AnimationData", (entity: PlayerMp, string) => {
entity.clearTasksImmediately(); entity.clearTasksImmediately();
if (string == null) { if (string == null) {
blockInput = false;
return; return;
} }
@@ -95,11 +98,9 @@
let { id, name, animDict, animName, duration, loop, flag } = animData; let { id, name, animDict, animName, duration, loop, flag } = animData;
loadAnimDict(animDict, function () { loadAnimDict(animDict, function () {
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1) mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 8, 1, duration, parseInt(flag), 0, !1, !1, !1)
}); });
blockInput = true;
let pair = pairData.find(pair => pair.from == string); let pair = pairData.find(pair => pair.from == string);
if (!pair) if (!pair)
return; return;