@@ -1,15 +1,17 @@
|
||||
export default function animationSync() {
|
||||
import { debug } from "util";
|
||||
|
||||
export default function animationSync() {
|
||||
let blockInput = false;
|
||||
let animationBreakTimer;
|
||||
|
||||
mp.events.add("SERVER:LoadAnimations", () => {
|
||||
animationSyncData.register("Cuffed", "mp_arresting", "idle", -1, true, 50);
|
||||
animationSyncData.register("doArrest", "mp_arrest_paired", "cop_p2_back_right", 3760, false, 0);
|
||||
animationSyncData.register("getArrest", "mp_arrest_paired", "crook_p2_back_right", 3760, false, 0);
|
||||
animationSyncData.register("doUncuff", "mp_arresting", "a_uncuff", 5500, false, 0);
|
||||
animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0);
|
||||
animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50);
|
||||
animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50);
|
||||
animationSyncData.register("Cuffed", "mp_arresting", "idle", -1, true, 50, false);
|
||||
animationSyncData.register("doArrest", "mp_arrest_paired", "cop_p2_back_right", 3760, false, 0, false);
|
||||
animationSyncData.register("getArrest", "mp_arrest_paired", "crook_p2_back_right", 3760, false, 0, false);
|
||||
animationSyncData.register("doUncuff", "mp_arresting", "a_uncuff", 5500, false, 0, false);
|
||||
animationSyncData.register("getUncuff", "mp_arresting", "b_uncuff", 5500, false, 0, false);
|
||||
animationSyncData.register("hup", "mp_am_hold_up", "handsup_base", -1, true, 50, true);
|
||||
animationSyncData.register("carryBox", "anim@heists@box_carry@", "idle", -1, true, 50, true);
|
||||
});
|
||||
|
||||
const animationBreakMessage = [
|
||||
@@ -20,7 +22,7 @@
|
||||
{
|
||||
animations: [],
|
||||
|
||||
register: function (name, animDict, animName, duration, loop, flag) {
|
||||
register: function (name, animDict, animName, duration, loop, flag, endless) {
|
||||
let id = mp.game.joaat(name);
|
||||
|
||||
if (!this.animations.hasOwnProperty(id)) {
|
||||
@@ -32,7 +34,8 @@
|
||||
animName: animName,
|
||||
duration: duration,
|
||||
loop: loop,
|
||||
flag: flag
|
||||
flag: flag,
|
||||
endless: endless
|
||||
};
|
||||
} else {
|
||||
mp.game.graphics.notify("Animation Sync Error: ~r~Duplicate Entry");
|
||||
@@ -98,16 +101,17 @@
|
||||
|
||||
let animData = animationSyncData.animations[index];
|
||||
|
||||
let { id, name, animDict, animName, duration, loop, flag } = animData;
|
||||
let { id, name, animDict, animName, duration, loop, flag, endless } = animData;
|
||||
|
||||
loadAnimDict(animDict, function () {
|
||||
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||
});
|
||||
if (!endless) {
|
||||
animationBreakTimer = setInterval(() => breakAnimation(name), 120000);
|
||||
}
|
||||
|
||||
if (mp.players.local == entity) {
|
||||
if (loop == true) {
|
||||
animationBreakTimer = setInterval(() => breakAnimation(id), 120000);
|
||||
} else {
|
||||
if (!loop) {
|
||||
let a = setInterval(function () {
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", true);
|
||||
|
||||
@@ -117,15 +121,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
function breakAnimation(id) {
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", false);
|
||||
let { animName, msg } = animationBreakMessage.find(c => mp.game.joaat(c.animName) == id)
|
||||
function breakAnimation(name) {
|
||||
let { animName, msg } = animationBreakMessage.find(c => c.animName == name)
|
||||
|
||||
if (msg)
|
||||
mp.events.call("renderTextOnScreen", msg);
|
||||
|
||||
clearInterval(animationBreakTimer);
|
||||
animationBreakTimer = null;
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", false);
|
||||
}
|
||||
|
||||
mp.events.add("render", () => {
|
||||
|
||||
@@ -106,11 +106,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
[Command("hup")]
|
||||
public void CmdAnim(Player player)
|
||||
{
|
||||
if (player.HasAnimation("hup")) { player.ClearAnimation(); return; }
|
||||
if (player.HasAnimation())
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
player.ToggleSurrender();
|
||||
}
|
||||
|
||||
[Command("event", "~m~Benutzung: ~s~/event [Nachricht]", GreedyArg = true)]
|
||||
|
||||
@@ -15,17 +15,15 @@ namespace ReallifeGamemode.Server.Events
|
||||
public class EnterVehicleAttempt : Script
|
||||
{
|
||||
public static GTANetworkAPI.Vehicle Roller;
|
||||
|
||||
[ServerEvent(Event.PlayerEnterVehicleAttempt)]
|
||||
public void OnPlayerEnterVehicleAttempt(Player player, GTANetworkAPI.Vehicle vehicle, sbyte seat)
|
||||
{
|
||||
if ((VehicleHash)vehicle.Model == VehicleHash.Dune3)
|
||||
{
|
||||
if (seat == 1) seat = 0;
|
||||
else if (seat == 0) seat = 1;
|
||||
}
|
||||
|
||||
if (seat != 0) return;
|
||||
|
||||
if (player.HasAnimation())
|
||||
player.StopAnimation();
|
||||
|
||||
User u = player.GetUser();
|
||||
|
||||
if (vehicle.GetServerVehicle() is FactionVehicle veh)
|
||||
@@ -84,7 +82,6 @@ namespace ReallifeGamemode.Server.Events
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (vehicle.GetServerVehicle() is SchoolVehicle sVeh)
|
||||
{
|
||||
|
||||
@@ -974,19 +974,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
[RemoteEvent("keyPress:ControllH")]
|
||||
public void KeyPressControllH(Player player)
|
||||
{
|
||||
if (player.HasAnimation("hup"))
|
||||
{
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
player.ClearAnimation();
|
||||
return;
|
||||
}
|
||||
if (player.HasAnimation())
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
player.ToggleSurrender();
|
||||
}
|
||||
|
||||
#endregion User Key
|
||||
|
||||
@@ -344,5 +344,22 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
PositionManager.cuffPoints.Remove(nearestCuffPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ToggleSurrender(this Player player)
|
||||
{
|
||||
if (player.HasAnimation("hup"))
|
||||
{
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
player.ClearAnimation();
|
||||
return;
|
||||
}
|
||||
if (player.HasAnimation())
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ namespace ReallifeGamemode.Server.Util
|
||||
|
||||
public static void SyncAnimation(this Player player, dynamic animationName)
|
||||
{
|
||||
if (player.IsInVehicle)
|
||||
return;
|
||||
|
||||
if (!player.HasData("Animation"))
|
||||
player.SetData("Animation", String.Empty);
|
||||
|
||||
@@ -71,6 +74,7 @@ namespace ReallifeGamemode.Server.Util
|
||||
if (!player.HasData("Animation"))
|
||||
return;
|
||||
|
||||
player.ClearAttachments();
|
||||
player.ResetData("Animation");
|
||||
player.ResetSharedData("AnimationData");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user