This commit is contained in:
2021-04-06 16:46:05 +02:00
parent 9d71fb3306
commit 67b5b8d5f0

View File

@@ -1,6 +1,6 @@
import planeSchoolHandle from "./planeschool";
export default function animationSync() {
let blockInput = false;
export default function animationSync() {
mp.events.add("SERVER:LoadAnimations", () => {
animationSyncData.register("Cuffed", "mp_arresting", "idle", -1, true, 50);
animationSyncData.register("doArrest", "mp_arrest_paired", "cop_p2_back_right", 3000, false, 0);
@@ -63,11 +63,7 @@ export default function animationSync() {
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) { //block player from using LMB to attack
mp.game.controls.disableControlAction(0, 24, true);
mp.game.controls.disableControlAction(0, 140, true);
mp.game.controls.disableControlAction(0, 141, true);
mp.game.controls.disableControlAction(0, 142, true);
mp.game.controls.disableControlAction(0, 257, true);
blockInput = true;
}
}
});
@@ -77,11 +73,7 @@ export default function animationSync() {
entity.clearTasksImmediately();
if (entity == mp.players.local) { //allow player using LMB to attack
mp.game.controls.disableControlAction(0, 24, false);
mp.game.controls.disableControlAction(0, 140, false);
mp.game.controls.disableControlAction(0, 141, false);
mp.game.controls.disableControlAction(0, 142, false);
mp.game.controls.disableControlAction(0, 257, false);
blockInput = false;
}
if (string == null) {
@@ -101,11 +93,7 @@ export default function animationSync() {
});
if (entity == mp.players.local) { //block player from using LMB to attack
mp.game.controls.disableControlAction(0, 24, true);
mp.game.controls.disableControlAction(0, 140, true);
mp.game.controls.disableControlAction(0, 141, true);
mp.game.controls.disableControlAction(0, 142, true);
mp.game.controls.disableControlAction(0, 257, true);
blockInput = true;
}
let pair = pairData.find(pair => pair.from == string);
@@ -118,6 +106,14 @@ export default function animationSync() {
}, duration);
});
mp.events.add("render", () => {
mp.game.controls.disableControlAction(32, 24, blockInput);
mp.game.controls.disableControlAction(32, 140, blockInput);
mp.game.controls.disableControlAction(32, 141, blockInput);
mp.game.controls.disableControlAction(32, 142, blockInput);
mp.game.controls.disableControlAction(32, 257, blockInput);
});
function loadAnimDict(animDict, callback) {
if (mp.game.streaming.hasAnimDictLoaded(animDict)) return void callback();
mp.game.streaming.requestAnimDict(animDict);