diff --git a/EXILED/Exiled.Events/Config.cs b/EXILED/Exiled.Events/Config.cs
index fd244f699b..021f5ef494 100644
--- a/EXILED/Exiled.Events/Config.cs
+++ b/EXILED/Exiled.Events/Config.cs
@@ -81,6 +81,12 @@ public sealed class Config : IConfig
[Description("Indicates whether thrown keycards can affect doors that don't require any permissions")]
public bool CanKeycardThrowAffectDoors { get; set; } = false;
+ ///
+ /// Gets or sets a value indicating whether custom escapes are allowed (Default false).
+ ///
+ [Description("Indicates whether custom escapes are allowed (Default false)")]
+ public bool AllowCustomEscapes { get; set; } = false;
+
///
/// Gets or sets a value indicating whether the SCP079 will recontained if there are no SCPs left.
///
diff --git a/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs
index 4a4fa0dcba..38b86390da 100644
--- a/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs
@@ -39,7 +39,7 @@ public EscapingEventArgs(ReferenceHub referenceHub, RoleTypeId newRole, EscapeSc
Player = Player.Get(referenceHub);
NewRole = newRole;
EscapeScenario = escapeScenario;
- IsAllowed = escapeScenario is not EscapeScenario.None and not EscapeScenario.CustomEscape;
+ IsAllowed = (escapeScenario is not EscapeScenario.None and not EscapeScenario.CustomEscape) || Events.Instance.Config.AllowCustomEscapes;
}
///
diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs b/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs
index 72bade7906..bc245bf9ca 100644
--- a/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs
@@ -11,16 +11,18 @@ namespace Exiled.Events.Patches.Events.Player
#pragma warning disable IDE0060
using System.Collections.Generic;
+ using System.Reflection;
using System.Reflection.Emit;
- using API.Enums;
using API.Features;
using API.Features.Pools;
using EventArgs.Player;
using Exiled.API.Features.Roles;
using Exiled.Events.Attributes;
+
using HarmonyLib;
- using PlayerRoles.FirstPersonControl;
+
+ using PlayerRoles;
using static HarmonyLib.AccessTools;
@@ -41,9 +43,15 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj) + offset;
-
+ int index = newInstructions.FindIndex(instruction => instruction.Is(OpCodes.Newobj, pluginAPIConstructor)) + offset;
newInstructions.InsertRange(
index,
new[]
@@ -72,7 +80,7 @@ private static IEnumerable Transpiler(IEnumerable