@@ -73,7 +73,7 @@
|
|||||||
let currentAnim = animationSyncData.animations[index];
|
let currentAnim = animationSyncData.animations[index];
|
||||||
let { id, name, animDict, animName, duration, loop, flag } = currentAnim;
|
let { id, name, animDict, animName, duration, loop, flag } = currentAnim;
|
||||||
|
|
||||||
if (loop && !player.isPlayingAnim(animDict, animName, 3)) {
|
if (loop == true && !player.isPlayingAnim(animDict, animName, 3)) {
|
||||||
loadAnimDict(animDict, function () {
|
loadAnimDict(animDict, function () {
|
||||||
mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
mp.players.exists(player) && 0 !== player.handle && player.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||||
});
|
});
|
||||||
@@ -104,22 +104,21 @@
|
|||||||
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, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mp.players.local == entity && loop) {
|
if (mp.players.local == entity) {
|
||||||
animationBreakTimer = setInterval(() => breakAnimation(entity, id), 120000);
|
if (loop == true) {
|
||||||
}
|
animationBreakTimer = setInterval(() => breakAnimation(id), 120000);
|
||||||
|
} else {
|
||||||
|
let a = setInterval(function () {
|
||||||
|
mp.events.callRemote("CLIENT:ClearAnimationData", true);
|
||||||
|
|
||||||
if (!loop) {
|
clearInterval(a);
|
||||||
let a = setInterval(function () {
|
}, duration);
|
||||||
mp.events.callRemote("CLIENT:ClearAnimationData", entity);
|
}
|
||||||
mp.events.callRemote("CLIENT:AnimPairTransition");
|
|
||||||
|
|
||||||
clearInterval(a);
|
|
||||||
}, duration);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function breakAnimation(entity, id) {
|
function breakAnimation(id) {
|
||||||
mp.events.callRemote("CLIENT:ClearAnimationData", entity);
|
mp.events.callRemote("CLIENT:ClearAnimationData", false);
|
||||||
let { animName, msg } = animationBreakMessage.find(c => mp.game.joaat(c.animName) == id)
|
let { animName, msg } = animationBreakMessage.find(c => mp.game.joaat(c.animName) == id)
|
||||||
|
|
||||||
if (msg)
|
if (msg)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReallifeGamemode.Database.Entities;
|
using ReallifeGamemode.Database.Entities;
|
||||||
using ReallifeGamemode.Database.Models;
|
using ReallifeGamemode.Database.Models;
|
||||||
|
using ReallifeGamemode.Server.Managers;
|
||||||
using ReallifeGamemode.Server.Services;
|
using ReallifeGamemode.Server.Services;
|
||||||
using ReallifeGamemode.Server.Types;
|
using ReallifeGamemode.Server.Types;
|
||||||
using ReallifeGamemode.Server.Util;
|
using ReallifeGamemode.Server.Util;
|
||||||
@@ -340,6 +341,7 @@ namespace ReallifeGamemode.Server.Extensions
|
|||||||
nearestCuffPlayer.AddAttachment("handcuffs", true);
|
nearestCuffPlayer.AddAttachment("handcuffs", true);
|
||||||
player.SyncAnimation("doUncuff");
|
player.SyncAnimation("doUncuff");
|
||||||
nearestCuffPlayer.SyncAnimation("getUncuff");
|
nearestCuffPlayer.SyncAnimation("getUncuff");
|
||||||
|
PositionManager.cuffPoints.Remove(nearestCuffPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,11 +35,17 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
List<string> nextAnimations = animations.Skip(1).ToList();
|
List<string> nextAnimations = animations.Skip(1).ToList();
|
||||||
player.SyncAnimation(animationName);
|
player.SyncAnimation(animationName);
|
||||||
|
|
||||||
if (nextAnimations.Count != 0)
|
if (nextAnimations.Count is 0)
|
||||||
{
|
{
|
||||||
player.TriggerEvent("SERVER:QueueAnimation", animationName);
|
animationPair.Remove(player);
|
||||||
animationPair.Add(player, nextAnimations);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
player.TriggerEvent("SERVER:QueueAnimation", animationName);
|
||||||
|
if (animationPair.ContainsKey(player))
|
||||||
|
animationPair[player] = nextAnimations;
|
||||||
|
else
|
||||||
|
animationPair.Add(player, nextAnimations);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Check if Player has any Animation playing.
|
/// <summary>Check if Player has any Animation playing.
|
||||||
@@ -55,6 +61,8 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
/// <param name="animationName">Name of requested animation</param>
|
/// <param name="animationName">Name of requested animation</param>
|
||||||
public static bool HasAnimation(this Player player, dynamic animationName)
|
public static bool HasAnimation(this Player player, dynamic animationName)
|
||||||
{
|
{
|
||||||
|
string data = player.GetData<string>("Animation");
|
||||||
|
bool x = player.GetData<string>("Animation") == animationName;
|
||||||
return player.HasData("Animation") && (player.GetData<string>("Animation") == animationName);
|
return player.HasData("Animation") && (player.GetData<string>("Animation") == animationName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,9 +90,11 @@ namespace ReallifeGamemode.Server.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
[RemoteEvent("CLIENT:ClearAnimationData")]
|
[RemoteEvent("CLIENT:ClearAnimationData")]
|
||||||
public void ClearAnimationData(Player player, Player target)
|
public void ClearAnimationData(Player player, bool checkTransition)
|
||||||
{
|
{
|
||||||
target.ClearAnimation();
|
player.ClearAnimation();
|
||||||
|
if (checkTransition)
|
||||||
|
AnimPairTransition(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
[ServerEvent(Event.PlayerWeaponSwitch)]
|
[ServerEvent(Event.PlayerWeaponSwitch)]
|
||||||
|
|||||||
Reference in New Issue
Block a user