This commit is contained in:
2021-04-06 23:54:32 +02:00
parent 9e77e5c75e
commit ddc71b7d8e
2 changed files with 6 additions and 4 deletions

View File

@@ -80,15 +80,15 @@
});
}, 100);
mp.events.add("SERVER:QueueAnimations", (nextAnimations, currentAnimation) => {
mp.events.add("SERVER:QueueAnimations", (JSON_nextAnimations, currentAnimation) => {
let index = mp.game.joaat(currentAnimation);
if (!animationSyncData.animations.hasOwnProperty(index)) return;
let currentAnim = animationSyncData.animations[index];
let { id, name, animDict, animName, duration, loop, flag } = currentAnim;
let interval = setInterval(function () {
mp.gui.chat.push(nextAnimations);
mp.events.callRemote("CLIENT:AnimPairTransition", nextAnimations);
mp.gui.chat.push(JSON_nextAnimations);
mp.events.callRemote("CLIENT:AnimPairTransition", JSON_nextAnimations);
clearInterval(interval);
}, duration);

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using GTANetworkAPI;
using Newtonsoft.Json;
namespace ReallifeGamemode.Server.Util
{
@@ -62,8 +63,9 @@ namespace ReallifeGamemode.Server.Util
public class AnimationSyncEvents : Script
{
[RemoteEvent("CLIENT:AnimPairTransition")]
public void AnimPairTransition(Player player, string[] transitionTo)
public void AnimPairTransition(Player player, string JSON_transitionTo)
{
string[] transitionTo = (string[])JsonConvert.DeserializeObject(JSON_transitionTo);
player.SendChatMessage(transitionTo.ToString());
player.SyncAnimation(transitionTo.ToList<string>());
}