Finish Cuff using AnimationSync
+ Added Command /cuff for LSPD and FIB (Wanteds can also be cuffed using the Interaction key). + Added Command /syncanim for Supporter * Player can now use CTRL + H to hup (/hup still usable) * Cuffs break after two minutes. TODO: - Players in Animation cannot enter Vehicle as driver neither can drive them. - Cuffed players will not loose their cuffs after reconnect.
This commit is contained in:
@@ -96,6 +96,13 @@
|
||||
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||
});
|
||||
|
||||
let b = setInterval(function () {
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", entity);
|
||||
if (name == "Cuffed" || name == "cuffed")
|
||||
mp.events.call("renderTextOnScreen", "Handschellen gebrochen.");
|
||||
clearInterval(b);
|
||||
}, 120000);
|
||||
|
||||
if (!loop) {
|
||||
let a = setInterval(function () {
|
||||
mp.events.callRemote("CLIENT:ClearAnimationData", entity);
|
||||
|
||||
@@ -8,7 +8,7 @@ export default function attachmentManager(game: IGame) {
|
||||
attachmentMngr.register("weapondeal", "ex_prop_crate_ammo_bc", "chassis_dummy", new mp.Vector3(0.08, -0.9, -0.2), new mp.Vector3(0, 0, 0));
|
||||
attachmentMngr.register("weapondeal1", "ex_office_swag_guns02", "chassis_dummy", new mp.Vector3(0, 0.8, 0), new mp.Vector3(0, 0, 0));
|
||||
attachmentMngr.register("weapondeal2", "w_sg_pumpshotgun", "chassis_dummy", new mp.Vector3(0.4, 1.6, 0.62), new mp.Vector3(90, 0, 180));
|
||||
attachmentMngr.register("handcuffs", "p_cs_cuffs_02_s", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 0, 0));
|
||||
attachmentMngr.register("handcuffs", "p_cs_cuffs_02_s", 28422, new mp.Vector3(0, 0, 0), new mp.Vector3(0, 90, 0));
|
||||
});
|
||||
|
||||
const attachmentMngr =
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
mp.events.add("render", () => {
|
||||
if (blockInput) {
|
||||
mp.game.controls.disableControlAction(32, 142, true);
|
||||
mp.game.controls.disableControlAction(32, 140, true);
|
||||
mp.game.controls.disableControlAction(32, 263, true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,33 +34,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
{
|
||||
#region Todo
|
||||
|
||||
[Command("cuff", "~m~Benutzung: ~s~/cuff [ID]")]
|
||||
public void CmdCuffTest(Player player, string nameOrId)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
Player target = PlayerService.GetPlayerByNameOrId(nameOrId);
|
||||
if (target.Id == player.Id)
|
||||
return;
|
||||
|
||||
target.SetInFrontOf(player);
|
||||
target.Heading = player.Heading;
|
||||
|
||||
if (!target.HasAnimation("Cuffed"))
|
||||
{
|
||||
player.SyncAnimation("doArrest");
|
||||
target.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SyncAnimation("doUncuff");
|
||||
target.SyncAnimation("getUncuff");
|
||||
}
|
||||
}
|
||||
|
||||
[Command("syncanim", "~m~Benutzung: ~s~/syncanim [animName]")]
|
||||
public void CmdSyncAnim(Player player, string animName = null)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ using ReallifeGamemode.Server.Factions.Medic;
|
||||
using ReallifeGamemode.Server.Managers;
|
||||
using ReallifeGamemode.Server.Services;
|
||||
using ReallifeGamemode.Server.Types;
|
||||
using ReallifeGamemode.Server.Util;
|
||||
using ReallifeGamemode.Services;
|
||||
|
||||
/**
|
||||
@@ -57,7 +58,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
string rank = string.Empty;
|
||||
|
||||
if(f?.Name == "Ballas" || f?.Name == "Grove")
|
||||
if (f?.Name == "Ballas" || f?.Name == "Grove")
|
||||
{
|
||||
rank = player.GetUser().GetFactionRank().RankName;
|
||||
}
|
||||
@@ -109,7 +110,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
string factionName = string.Empty;
|
||||
|
||||
if(f?.StateOwned ?? false)
|
||||
if (f?.StateOwned ?? false)
|
||||
{
|
||||
factionName = u.GetFactionRank().RankName;
|
||||
}
|
||||
@@ -127,7 +128,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
|
||||
#endregion Chat Commands
|
||||
|
||||
|
||||
#region NewsReporter commands
|
||||
|
||||
[Command("news", "~m~Benutzung: ~s~/news [Nachricht]", GreedyArg = true)]
|
||||
@@ -139,12 +139,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
if (player.GetUser().Faction.Id == 9 )
|
||||
if (player.GetUser().Faction.Id == 9)
|
||||
{
|
||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
|
||||
string broadcastMessage = "!{ff9531}** News Reporter" + " " + player.Name + ": " + message + " **";
|
||||
ChatService.Broadcast(broadcastMessage);
|
||||
ChatService.Broadcast(broadcastMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -152,11 +152,8 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endregion NewsReporter commands
|
||||
|
||||
#region Leader Commands
|
||||
|
||||
[Command("giverank", "~m~Benutzung: ~s~/giverank [Name] [Rang]", GreedyArg = true)]
|
||||
@@ -212,7 +209,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
message = Regex.Replace(message, "(~[a-zA-Z]~)|(!{(.*)})", "");
|
||||
|
||||
string factionName = string.Empty;
|
||||
if(user.FactionLeader)
|
||||
if (user.FactionLeader)
|
||||
{
|
||||
factionName = player.GetUser().Faction.Name;
|
||||
}
|
||||
@@ -329,7 +326,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
deadPlayerUser.Handmoney = 0;
|
||||
deadPlayerUser.BankAccount.Balance -= bankMoney;
|
||||
}
|
||||
|
||||
|
||||
player.PlayAnimation("amb@medic@standing@kneel@enter", "enter", 0);
|
||||
|
||||
deadPlayer.TriggerEvent("onPlayerRevived");
|
||||
@@ -363,7 +360,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.Position.DistanceTo(target.Position) > 5)
|
||||
if (player.Position.DistanceTo(target.Position) > 5)
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Der Patient ist zu weit entfernt");
|
||||
return;
|
||||
@@ -398,16 +395,54 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
ChatService.SendMessage(target,"~g~" + player.Name + " ~s~möchte dich für ~g~$" + price + " ~s~heilen. Drücke ~g~J~s~ zum Erlauben oder ~r~N ~s~zum Verbieten");
|
||||
player.SendNotification("Du hast " + target.Name + " einen Heal angeboten",false);
|
||||
ChatService.SendMessage(target, "~g~" + player.Name + " ~s~möchte dich für ~g~$" + price + " ~s~heilen. Drücke ~g~J~s~ zum Erlauben oder ~r~N ~s~zum Verbieten");
|
||||
player.SendNotification("Du hast " + target.Name + " einen Heal angeboten", false);
|
||||
target.SetData<bool>("healDecision", true);
|
||||
Medic.HealDecisions.Add(new Medic.HealDecision {dMedic = player, dTarget = target, dPrice = price});
|
||||
Medic.HealDecisions.Add(new Medic.HealDecision { dMedic = player, dTarget = target, dPrice = price });
|
||||
}
|
||||
|
||||
#endregion Sanitäter Commands
|
||||
|
||||
#region Staatsfraktionen (LSPD / FBI) Commands
|
||||
|
||||
[Command("cuff", "~m~Benutzung: ~s~/cuff")]
|
||||
public void CmdFactionCuff(Player player)
|
||||
{
|
||||
User user = player.GetUser();
|
||||
if (user == null || (user.FactionId != 1 && user.FactionId != 3))
|
||||
{
|
||||
ChatService.NotAuthorized(player);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player.IsDuty())
|
||||
{
|
||||
ChatService.ErrorMessage(player, "Du bist nicht im Dienst");
|
||||
return;
|
||||
}
|
||||
|
||||
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
|
||||
|
||||
if (nearestCuffPlayer is null)
|
||||
return;
|
||||
|
||||
nearestCuffPlayer.SetInFrontOf(player);
|
||||
nearestCuffPlayer.Heading = player.Heading;
|
||||
|
||||
if (!nearestCuffPlayer.HasAnimation("Cuffed"))
|
||||
{
|
||||
player.SyncAnimation("doArrest");
|
||||
nearestCuffPlayer.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
|
||||
player.AddAttachment("handcuffs", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.AddAttachment("handcuffs", true);
|
||||
player.SyncAnimation("doUncuff");
|
||||
nearestCuffPlayer.SyncAnimation("getUncuff");
|
||||
}
|
||||
}
|
||||
|
||||
[Command("wanted", "~m~Benutzung: ~s~/wa(nted) [Spieler] [Anzahl] [Grund]", Alias = "wa", GreedyArg = true)]
|
||||
public void CmdFactionWanted(Player player, string nameOrId, int amount, string reason)
|
||||
{
|
||||
@@ -480,7 +515,7 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
ChatService.SendMessage(target, "!{#8181E9}Deine Akte wurde von " + player.Name + " gelöscht. Grund: " + reason);
|
||||
ChatService.BroadcastFaction("!{#8181E9}HQ: Die Akte von " + target.Name + " wurde von " + player.Name + " gelöscht. Grund: " + reason + ".", new List<int>() { 1, 3 });
|
||||
|
||||
|
||||
target.TriggerEvent("jailTime", 0);
|
||||
targetUser.Wanteds = 0;
|
||||
|
||||
@@ -491,11 +526,12 @@ namespace ReallifeGamemode.Server.Commands
|
||||
}
|
||||
|
||||
#endregion Staatsfraktionen (LSPD / FBI) Commands
|
||||
|
||||
#region Weazel News
|
||||
|
||||
[Command("eventchat", "~m~Benutzung: ~s~/eventchat [Typ = ~g~on~s~, ~g~off~s~]", GreedyArg = true)]
|
||||
public void CmdFactionNREventchat(Player player, string onoff)
|
||||
{
|
||||
|
||||
switch (onoff.ToLower())
|
||||
{
|
||||
case "on":
|
||||
@@ -513,14 +549,9 @@ namespace ReallifeGamemode.Server.Commands
|
||||
});
|
||||
player.SendNotification("Der Eventchat ist nun aus.");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion Weazel News
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -111,7 +111,6 @@ namespace ReallifeGamemode.Server.Commands
|
||||
return;
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
ChatService.SendInRange(player.Position, 20, $"~m~{player.Name} stellt sich...");
|
||||
}
|
||||
|
||||
[Command("event", "~m~Benutzung: ~s~/event [Nachricht]", GreedyArg = true)]
|
||||
|
||||
@@ -218,6 +218,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
FriseurPoint nearestFriseurPoint = PositionManager.friseurPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5 && (!user.GetData<bool>("duty")));
|
||||
ItemshopPoint nearestItemShopPoint = PositionManager.itemshopPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.5);
|
||||
JobPoint nearestJobPoint = PositionManager.JobPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6);
|
||||
Player nearestCuffPlayer = PositionManager.cuffPoints.Find(s => s.Position.DistanceTo(player.Position) <= 1.6 && user.GetData<bool>("duty"));
|
||||
|
||||
if (user?.FactionId != null)
|
||||
{
|
||||
@@ -507,6 +508,24 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
player.TriggerEvent("showJailMenu", JsonConvert.SerializeObject(criminals.ToArray()));
|
||||
}
|
||||
if (nearestCuffPlayer != null)
|
||||
{
|
||||
nearestCuffPlayer.SetInFrontOf(player);
|
||||
nearestCuffPlayer.Heading = player.Heading;
|
||||
|
||||
if (!nearestCuffPlayer.HasAnimation("Cuffed"))
|
||||
{
|
||||
player.SyncAnimation("doArrest");
|
||||
nearestCuffPlayer.SyncAnimation(new List<string>() { "getArrest", "Cuffed" });
|
||||
player.AddAttachment("handcuffs", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.AddAttachment("handcuffs", true);
|
||||
player.SyncAnimation("doUncuff");
|
||||
nearestCuffPlayer.SyncAnimation("getUncuff");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nearestElevatorPoint != null)
|
||||
{
|
||||
@@ -969,14 +988,19 @@ namespace ReallifeGamemode.Server.Events
|
||||
[RemoteEvent("keyPress:ControllH")]
|
||||
public void KeyPressControllH(Player player)
|
||||
{
|
||||
if (player.HasAnimation("hup")) { player.ClearAnimation(); player.AddAttachment("handcuffs", true); return; }
|
||||
if (player.HasAnimation("hup"))
|
||||
{
|
||||
PositionManager.cuffPoints.Remove(player);
|
||||
player.ClearAnimation();
|
||||
return;
|
||||
}
|
||||
if (player.HasAnimation())
|
||||
return;
|
||||
|
||||
player.AddAttachment("handcuffs", false);
|
||||
|
||||
player.SyncAnimation("hup");
|
||||
ChatService.SendInRange(player.Position, 20, $"~m~{player.Name} stellt sich...");
|
||||
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
}
|
||||
|
||||
#endregion User Key
|
||||
|
||||
@@ -321,5 +321,10 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
{
|
||||
player.TriggerEvent("SERVER:SetInFrontPosition", entity);
|
||||
}
|
||||
|
||||
public static void SetCuffable(this Player player, bool isCuffable)
|
||||
{
|
||||
player.SetSharedData("Cuffable", isCuffable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace ReallifeGamemode.Server.Managers
|
||||
|
||||
public static List<JobPoint> JobPoints = new List<JobPoint>();
|
||||
|
||||
public static List<Player> cuffPoints = new List<Player>();
|
||||
|
||||
public static void LoadPositionManager()
|
||||
{
|
||||
#region DutyPoints
|
||||
|
||||
Reference in New Issue
Block a user