HELPME

mail@pastecode.io avatar
unknown
csharp
2 years ago
4.1 kB
10
Indexable
Never
public static Plugin plugin;

        public List<Exiled.API.Features.Player> players = new List<Player>();
        System.Random r = new System.Random();
        Exiled.API.Features.Player scp;
        public RoleType scprole;


        public void OnRoundStart()
        {
            Timing.RunCoroutine(OnRoundStartIE());

        }

        public void OnDying(DyingEventArgs ev) {
            if (ev.Target.Role == RoleType.ClassD) {
                ev.Target.SetRole(scprole);
            }
            if (ev.Killer.Role == scprole) {
                Map.Broadcast(3, $"{ev.Killer.Nickname} killed {ev.Target.Nickname}!");
            }
        }

        public IEnumerator<float> OnRoundStartIE() {
            yield return Timing.WaitForSeconds(0.5f);
            LightContainmentZoneDecontamination.DecontaminationController.Singleton.disableDecontamination = true;
            foreach (var ply in Player.List)
            {
                players.Add(ply);
            }
            yield return Timing.WaitForSeconds(0.5f);
            for (int i = 0; i < players.Count; i++)
            {
                players[i].SetRole(RoleType.ClassD);
            }
            scp = players[r.Next(0, players.Count)];
            if (plugin.Config.ScpNum == 173)
            {
                scprole = RoleType.Scp173;
            }
            else if (plugin.Config.ScpNum == 106)
            {
                scprole = RoleType.Scp106;
            }
            else if (plugin.Config.ScpNum == 049)
            {
                scprole = RoleType.Scp049;
            }
            else if (plugin.Config.ScpNum == 93953)
            {
                scprole = RoleType.Scp93953;
            }
            else if (plugin.Config.ScpNum == 93989)
            {
                scprole = RoleType.Scp93989;
            }
            else if (plugin.Config.ScpNum == 096)
            {
                scprole = RoleType.Scp096;
            }
            else if (plugin.Config.ScpNum == 0492)
            {
                scprole = RoleType.Scp0492;
            }
            Map.Broadcast(3, "Choosing SCP...");
            yield return Timing.WaitForSeconds(0.5f);
            foreach (var door1 in Map.Doors)
            {
                if (!door1.IsLocked)
                {
                    door1.ChangeLock(Exiled.API.Enums.DoorLockType.AdminCommand);
                    door1.IsOpen = false;

                }
                if (door1.Type == Exiled.API.Enums.DoorType.HczArmory)
                {

                    door1.AllowsScp106 = false;
                }
            }
            yield return Timing.WaitForSeconds(2.5f);
            Map.Broadcast(7, $"And now {scp.Nickname} is SCP-{plugin.Config.ScpNum}!");
            yield return Timing.WaitForSeconds(0.5f);
            scp.SetRole(scprole);
            yield return Timing.WaitForSeconds(0.5f);
            foreach (var room in Map.Rooms)
            {
                if (room.Type == Exiled.API.Enums.RoomType.HczArmory)
                {
                    scp.Position = new Vector3(room.Position.x, room.Position.y + 2, room.Position.z);
                }
            }
            yield return Timing.WaitForSeconds(5f);
            Map.Broadcast(10, $"Event started, try to avoid SCP-{plugin.Config.ScpNum}!");
            Cassie.Message(".g7", false, false);
            foreach (var doorr in Map.Doors)
            {
                if (doorr.IsLocked && (doorr.Type != Exiled.API.Enums.DoorType.HczArmory || doorr.Type != Exiled.API.Enums.DoorType.GateA || doorr.Type != Exiled.API.Enums.DoorType.GateB))
                {
                    doorr.Unlock();
                }
            }
            yield return Timing.WaitForSeconds(10f);
            Door door = Map.Doors.FirstOrDefault(d => d.Type == Exiled.API.Enums.DoorType.HczArmory);
            if (door.IsLocked && door.Type == Exiled.API.Enums.DoorType.HczArmory)
            {
                door.Unlock();
                door.IsOpen = true;
            }
        }