From 6463114ccf94266d4d426e8e59d5b476c958833b Mon Sep 17 00:00:00 2001 From: kookroach Date: Tue, 6 Apr 2021 19:20:56 +0200 Subject: [PATCH] test --- ReallifeGamemode.Client/util/animationSync.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ReallifeGamemode.Client/util/animationSync.ts b/ReallifeGamemode.Client/util/animationSync.ts index bb8dc3e3..ac88ec1d 100644 --- a/ReallifeGamemode.Client/util/animationSync.ts +++ b/ReallifeGamemode.Client/util/animationSync.ts @@ -49,11 +49,19 @@ */ setInterval(() => { + if (mp.players.local.getVariable("AnimationData")) { + blockInput = true; + } else { + blockInput = false; + } + mp.players.forEachInStreamRange( (player) => { if (!player.getVariable("AnimationData")) { return; } + if (player != mp.players.local) + mp.game.wait(200); let index = mp.game.joaat(player.getVariable("AnimationData")); let currentAnim = animationSyncData.animations[index]; @@ -64,13 +72,9 @@ loadAnimDict(animDict, function () { 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)) { let a = setInterval(function () { if (player == mp.players.local) { - blockInput = false; mp.events.callRemote("CLIENT:ClearAnimationData", player); } clearInterval(a); @@ -82,7 +86,6 @@ mp.events.addDataHandler("AnimationData", (entity: PlayerMp, string) => { entity.clearTasksImmediately(); if (string == null) { - blockInput = false; return; } @@ -95,11 +98,9 @@ let { id, name, animDict, animName, duration, loop, flag } = animData; 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); if (!pair) return;