diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs
index ddad6ca4ce..80a09d4aa7 100644
--- a/EXILED/Exiled.API/Features/Player.cs
+++ b/EXILED/Exiled.API/Features/Player.cs
@@ -584,7 +584,7 @@ public Role Role
get => role ??= Role.Create(RoleManager.CurrentRole);
internal set
{
- PreviousRole = role.Type;
+ PreviousRole = role?.Type ?? RoleTypeId.None;
role = value;
}
}
diff --git a/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs b/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs
new file mode 100644
index 0000000000..42e6cfe349
--- /dev/null
+++ b/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs
@@ -0,0 +1,36 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) ExMod Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.API.Features.Roles
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ using PlayerRoles;
+ using PlayerRoles.Voice;
+
+ ///
+ /// Defines a role that represents players with destroyed role.
+ ///
+ internal class DestroyedRole : Role
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// the base .
+ internal DestroyedRole(PlayerRoleBase baseRole)
+ : base(baseRole)
+ {
+ }
+
+ ///
+ public override RoleTypeId Type { get; } = RoleTypeId.Destroyed;
+ }
+}
diff --git a/EXILED/Exiled.API/Features/Roles/Role.cs b/EXILED/Exiled.API/Features/Roles/Role.cs
index 6edc4f4098..0b636e95f8 100644
--- a/EXILED/Exiled.API/Features/Roles/Role.cs
+++ b/EXILED/Exiled.API/Features/Roles/Role.cs
@@ -18,6 +18,7 @@ namespace Exiled.API.Features.Roles
using PlayerRoles.PlayableScps.Scp049.Zombies;
using UnityEngine;
+ using DestroyedGameRole = PlayerRoles.DestroyedRole;
using FilmmakerGameRole = PlayerRoles.Filmmaker.FilmmakerRole;
using HumanGameRole = PlayerRoles.HumanRole;
using NoneGameRole = PlayerRoles.NoneRole;
@@ -228,6 +229,7 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s
HumanGameRole humanRole => new HumanRole(humanRole),
FilmmakerGameRole filmmakerRole => new FilmMakerRole(filmmakerRole),
NoneGameRole noneRole => new NoneRole(noneRole),
+ DestroyedGameRole destroyedRole => new DestroyedRole(destroyedRole),
_ => null,
};
}