Пример #1
0
        /// <inheritdoc />
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!sender.CheckPermission(RequiredPermission))
            {
                response = $"Insufficient permission. Required: {RequiredPermission}";
                return(false);
            }

            Player player = Player.Get((sender as PlayerCommandSender)?.ReferenceHub);

            if (arguments.Count > 0)
            {
                if (!(Player.Get(arguments.At(0)) is Player ply))
                {
                    response = "Could not find the referenced user.";
                    return(false);
                }

                player = ply;
            }

            if (Scp457.Get(player) != null)
            {
                response = $"{player.Nickname} is already a Scp457!";
                return(false);
            }

            Scp457.Spawn(player);
            response = $"Spawned {player.Nickname} as a Scp457.";
            return(true);
        }
Пример #2
0
        private static void OnRoundStarted()
        {
            Timing.CallDelayed(1.5f, () =>
            {
                if (Plugin.Instance.Config.Scp457Settings.SpawnChance <= Random.Range(0, 100))
                {
                    return;
                }

                List <Player> players = Player.List.Where(ply => ply.Team == Team.SCP && !ply.IsNpc()).ToList();
                if (players.Count == 0)
                {
                    return;
                }

                Player player = players[Random.Range(0, players.Count)];
                Scp457.Spawn(player);
            });
        }