コード例 #1
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            string[] args = CommandUtils.StringToArgs(ev.Command);

            if (args.Any())
            {
                NetworkResponse response;

                switch (args[0].ToUpper())
                {
                case "CONNECT":
                    if (args.Length >= 2)
                    {
                        response = TDHPlugin.SendClientRequest($"FINISHCONNECT {ev.Player.SteamId} Console {args[1]}");
                    }
                    else
                    {
                        response = TDHPlugin.SendClientRequest($"CONNECT {ev.Player.SteamId} Console");
                    }

                    ev.ReturnMessage = response?.content ?? "Unable to send request";

                    break;

                case "DISCONNECT":
                    response = TDHPlugin.SendClientRequest($"DISCONNECT {ev.Player.SteamId} Console");

                    ev.ReturnMessage = response?.content ?? "Unable to send request";

                    break;
                }
            }
        }
コード例 #2
0
ファイル: EventHandler.cs プロジェクト: Cyanox62/VoteKick
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            b = UnityEngine.Object.FindObjectOfType <Broadcast>();
            string cmd = ev.Command.ToLower();

            if (cmd.StartsWith("votekick"))
            {
                if (VoteKick.isPlayerBanned(ev.Player))
                {
                    ev.ReturnMessage = "You have been banned from using VoteKick.";
                    return;
                }
                vPlayerCount     = PluginManager.Manager.Server.GetPlayers().Count;
                ev.ReturnMessage = StartVote(ev.Command, ev.Player);
            }
            else if (cmd == "voteyes")
            {
                if (VoteKick.isPlayerBanned(ev.Player))
                {
                    ev.ReturnMessage = "You have been banned from using VoteKick.";
                    return;
                }
                ev.ReturnMessage = Vote(true, ev.Player);
            }
            else if (cmd == "voteno")
            {
                if (VoteKick.isPlayerBanned(ev.Player))
                {
                    ev.ReturnMessage = "You have been banned from using VoteKick.";
                    return;
                }
                ev.ReturnMessage = Vote(false, ev.Player);
            }
        }
コード例 #3
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (ev.Command.StartsWith("c4modeon"))
            {
                if ((NTFlic4.ContainsKey(ev.Player.SteamId)) && (ev.Player.TeamRole.Role == Role.NTF_LIEUTENANT) && (NTFlic4[ev.Player.SteamId] == true))
                {
                    ev.Player.SendConsoleMessage("Ya estan activados", "blue");
                }
                if ((NTFlic4.ContainsKey(ev.Player.SteamId)) && (ev.Player.TeamRole.Role == Role.NTF_LIEUTENANT) && (NTFlic4[ev.Player.SteamId] == false))
                {
                    NTFlic4[ev.Player.SteamId] = true; ev.ReturnMessage = "C4 activados";
                }

                if (ev.Player.TeamRole.Role != Role.NTF_LIEUTENANT)
                {
                    ev.ReturnMessage = "Tu no eres Teniente";
                }
            }
            if (ev.Command.StartsWith("c4modeoff"))
            {
                if ((NTFlic4.ContainsKey(ev.Player.SteamId)) && (ev.Player.TeamRole.Role == Role.NTF_LIEUTENANT) && (NTFlic4[ev.Player.SteamId] == false))
                {
                    ev.Player.SendConsoleMessage("Ya estan desactivados", "blue");
                }
                if ((NTFlic4.ContainsKey(ev.Player.SteamId)) && (ev.Player.TeamRole.Role == Role.NTF_LIEUTENANT) && (NTFlic4[ev.Player.SteamId] == true))
                {
                    NTFlic4[ev.Player.SteamId] = false; ev.ReturnMessage = "C4 desactivados";
                }
                if (ev.Player.TeamRole.Role != Role.NTF_LIEUTENANT)
                {
                    ev.ReturnMessage = "Tu no eres Teniente";
                }
            }
        }
コード例 #4
0
ファイル: SCP_343EventLogic.cs プロジェクト: MrMith/SCP-343
        /// <summary>
        /// This is called whenever a client types <see cref=".revert343"/> in client console (One you open with ~) but the . is stripped out so we can check if the command is equal to revert343
        /// </summary>
        /// <param name="ev"></param>
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (!_343Config.SCP343_revert)
            {
                return;
            }

            if (ev.Command.ToLower() == "revert343")
            {
                if (Is343(ev.Player))
                {
                    if (plugin.Server.Round.Duration >= _343Config.SCP343_RevertTime)
                    {
                        ev.ReturnMessage = "It's too late! You're 343 till death do you part.";
                        return;
                    }

                    ///We change the player to a default D-Class and feed the function true (so it resets items and HP) and false so it doesn't teleport them to the default spawn location.
                    ev.Player.ChangeRole(Smod2.API.RoleType.CLASSD, true, false);

                    ev.ReturnMessage = "You're no longer SCP-343.";
                    return;
                }
                ev.ReturnMessage = "Wait you're not 343!";
                return;
            }
        }
コード例 #5
0
ファイル: EventHandler.cs プロジェクト: moseechev/PlayerXP
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (ev.Command.ToLower().StartsWith("level") || ev.Command.ToLower().StartsWith("lvl"))
            {
                string   msg = "\n";
                string[] a   = new LevelCommand(plugin).OnCall(ev.Player, PlayerXP.StringToStringArray(ev.Command.Replace(ev.Command.ToLower().StartsWith("level") ? "level " : "lvl ", "")));
                for (int i = 0; i < a.Length; i++)
                {
                    msg += a[i];
                    if (i != a.Length - 1)
                    {
                        msg += Environment.NewLine;
                    }
                }
                ev.ReturnMessage = msg;
            }

            if (ev.Command.ToLower().StartsWith("leaderboard"))
            {
                string   msg = "\n";
                string[] a   = new LeaderboardCommand(plugin).OnCall(ev.Player, PlayerXP.StringToStringArray(ev.Command.Replace("leaderboard ", "")));
                for (int i = 0; i < a.Length; i++)
                {
                    msg += a[i];
                    if (i != a.Length - 1)
                    {
                        msg += Environment.NewLine;
                    }
                }
                ev.ReturnMessage = msg;
            }
        }
コード例 #6
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            plugin.Info(ev.Command);
            if (ev.Command.ToLower() == "killinfo")
            {
                if (!CheckSteamIDForKillInfo.ContainsKey(ev.Player.SteamId))
                {
                    CheckSteamIDForKillInfo[ev.Player.SteamId] = KillReadAndWrite.ReadPlayerBySteamID(ev.Player.SteamId);
                }

                ev.Player.SendConsoleMessage($"Твоя точность: {CheckSteamIDForKillInfo[ev.Player.SteamId].GetShotInfo(2)}%.");

                foreach (DamageType dmgtype in (DamageType[])Enum.GetValues(typeof(DamageType)))
                {
                    if (CheckSteamIDForKillInfo[ev.Player.SteamId].GetKillByDamageType(dmgtype) != 0)
                    {
                        ev.Player.SendConsoleMessage("Ты убил " + CheckSteamIDForKillInfo[ev.Player.SteamId].GetKillByDamageType(dmgtype) + " человек с помощью " + dmgtype.ToString().Replace("_", "-") + ".");
                    }
                }

                if (CheckSteamIDForKillInfo[ev.Player.SteamId].GetAmountOfDeaths() == 0)
                {
                    ev.Player.SendConsoleMessage("Твой КДА " + CheckSteamIDForKillInfo[ev.Player.SteamId].GetAmountOfKills() + ". ");
                }
                else
                {
                    ev.Player.SendConsoleMessage($"Твой КДА {(float)CheckSteamIDForKillInfo[ev.Player.SteamId].GetAmountOfKills() / (float)CheckSteamIDForKillInfo[ev.Player.SteamId].GetAmountOfDeaths()}.");
                }
            }
        }
コード例 #7
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            string command = ev.Command.ToLower();

            if (CommandAliases?.Any(x => command.StartsWith(x)) ?? false)
            {
                MatchCollection collection = new Regex("[^\\s\"\']+|\"([^\"]*)\"|\'([^\']*)\'").Matches(command);
                string[]        args       = new string[collection.Count - 1];

                for (int i = 1; i < collection.Count; i++)
                {
                    // If it's wrapped in quotes,
                    if (collection[i].Value[0] == '\"' && collection[i].Value[collection[i].Value.Length - 1] == '\"')
                    {
                        args[i - 1] = collection[i].Value.Substring(1, collection[i].Value.Length - 2);
                    }
                    else
                    {
                        args[i - 1] = collection[i].Value;
                    }
                }

                if (args.Length > 0)
                {
                    if (args.Length > 1)
                    {
                        switch (args[0])
                        {
                        case "hash" when args[1].Length != PpPlugin.Roles.Count:
コード例 #8
0
 public void OnCallCommand(PlayerCallCommandEvent ev)
 {
     if (ev.Command.StartsWith("newpos"))
     {
         if (!plugin.allowedranks.Contains(ev.Player.GetUserGroup().Name))
         {
             ev.ReturnMessage = "You can't use this command.";
             return;
         }
         var     scp049Component = ((GameObject)ev.Player.GetGameObject()).GetComponent <Scp049PlayerScript>();
         var     scp106Component = (ev.Player.GetGameObject() as GameObject).GetComponent <Scp106PlayerScript>();
         Vector3 plyRot          = scp049Component.plyCam.transform.forward;
         Physics.Raycast(scp049Component.plyCam.transform.position, plyRot, out RaycastHit where, 40f, scp106Component.teleportPlacementMask);
         if (where.point.Equals(Vector3.zero))
         {
             ev.ReturnMessage = "Failed to spawn the coin. Try another place.";
         }
         else
         {
             Vector rotation = new Vector(-plyRot.x, plyRot.y, -plyRot.z), position = Spawner.Vec3ToVector(where.point) + (Vector.Up * 0.1f);
             PluginManager.Manager.Server.Map.SpawnItem(ItemType.COIN, position, rotation);
             spawnedCoins.Add(new PosVectorPair(position, rotation));
             Room room = ClosestRoom(where.point);
             ev.ReturnMessage = "Added " + where.point.ToString() + " to the list."
                                + "\nYou're probably looking for the RoomType: " + room.RoomType.ToString();
         }
     }
 }
コード例 #9
0
 void IEventHandlerCallCommand.OnCallCommand(PlayerCallCommandEvent ev)
 {
     send(ev, new IdMapping()
          .appendId(Lib.PLAYER_ID, ev.Player)
          .appendId(Lib.PLAYER_EVENT_SCPDATA_ID, ev.Player.Scp079Data)
          .appendId(Lib.PLAYER_EVENT_TEAM_ROLE_ID, ev.Player.TeamRole)
          );
 }
コード例 #10
0
 void IEventHandlerCallCommand.OnCallCommand(PlayerCallCommandEvent ev)
 {
     /*if (ev.Command.Equals("listplayers"))
      * {
      *  foreach (var id in toBeKilled)
      *  {
      *      ev.ReturnMessage += id + " ";
      *  }
      * }*/
 }
コード例 #11
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            string command = ev.Command.ToLower();

            switch (command)
            {
            case "sod enable":
                ev.ReturnMessage = EnablePlayerReplace(ev.Player);
                break;

            case "sod disable":
                ev.ReturnMessage = DisablePlayerReplace(ev.Player);
                break;
            }
        }
コード例 #12
0
ファイル: EventHandler.cs プロジェクト: Asnxthaony/Suicide
 public void OnCallCommand(PlayerCallCommandEvent ev)
 {
     if (ev.Command.ToLower().StartsWith("suicide"))
     {
         if (ev.Player.GetHealth() > 0)
         {
             ev.Player.Kill(DamageType.NONE);
             ev.ReturnMessage = "<color=\"orange\">Goodbye cruel world</color>";
         }
         else
         {
             ev.ReturnMessage = "You were died.";
         }
     }
 }
コード例 #13
0
ファイル: CheckRun.cs プロジェクト: 1312255201/YYYlike
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (ev.Player.TeamRole.Role == Smod2.API.Role.SCP_079)
            {
                if (choise == false)
                {
                    if (ev.Command.Contains("scp"))
                    {
                        scp    = true;
                        choise = true;
                        foreach (Player player in plugin.Server.GetPlayers())
                        {
                            if (player.TeamRole.Role == Smod2.API.Role.SCP_079)
                            {
                                player.SetRank("aqua", "SCP079 - 帮助SCP", null);
                            }
                        }

                        plugin.Server.Map.Broadcast(10, "<color=#FFC0CB>---[SCP079]---</color>\n<color=aqua>人类感受恐惧吧 本局SCP079选择帮助SCP</color>\n<color=aqua>SCP不会受到电网伤害(人形scp除外)</color>", false);
                    }
                    if (ev.Command.Contains("h"))
                    {
                        foreach (Player player in plugin.Server.GetPlayers())
                        {
                            if (player.TeamRole.Role == Smod2.API.Role.SCP_079)
                            {
                                player.SetRank("aqua", "SCP079 - 最大电力:130 | 电力恢复:3AP/s   帮助人类", null);
                            }
                        }
                        h = true;
                        ev.Player.SetRank("aqua", "SCP079 - 最大电力:130 | 电力恢复:3AP/s   帮助人类", null);
                        choise = true;
                        plugin.Server.Map.Broadcast(10, "<color=#FFC0CB>---[SCP079]---</color>\n<color=aqua>SCP没想到吧我是25仔 本局SCP079选择帮助人类</color>\n<color=aqua>人类不会受到电网伤害</color>", false);
                        foreach (Player p in plugin.Server.GetPlayers())
                        {
                            if (p.TeamRole.Team == Smod2.API.Team.SCP)
                            {
                                if (p.TeamRole.Role != Smod2.API.Role.SCP_106)
                                {
                                    p.SetHealth(p.GetHealth() + 3000);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #14
0
 public void OnCallCommand(PlayerCallCommandEvent ev)
 {
     if (ev.Command.ToLower().StartsWith("spawnscp457"))
     {
         string[] a   = new SpawnSCP457Command(plugin).OnCall(ev.Player, SCP457.StringToStringArray(ev.Command.Replace("spawnscp457 ", "")));
         string   msg = "\n";
         for (int i = 0; i < a.Length; i++)
         {
             msg += a[i];
             if (i != a.Length - 1)
             {
                 msg += Environment.NewLine;
             }
         }
         ev.ReturnMessage = msg;
     }
 }
コード例 #15
0
ファイル: SCPRadio.cs プロジェクト: sanyae2439/SCPRadio
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            plugin.Debug($"[OnCallCommand] {ev.Player.Name} -> {ev.Command}");

            if (ev.ReturnMessage == "Command not found.")
            {
                if (ev.Command.ToUpper().StartsWith("SCPRADIO"))
                {
                    plugin.Debug("command called");

                    Radio radio = (ev.Player.GetGameObject() as GameObject).GetComponent <Radio>();

                    radio.NetworkisTransmitting = !radio.isTransmitting;

                    ev.ReturnMessage = $"OK. (changed to {radio.isTransmitting})";
                }
            }
        }
コード例 #16
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (ev.Command.StartsWith("fc") && (ev.Command.Length == 2 || ev.Command[2] == ' '))
            {
                if (!plugin.Active)
                {
                    ev.ReturnMessage = "Blackout is not running this round.";
                    return;
                }

                if (ev.Command.Length < 4)
                {
                    ev.ReturnMessage = "Please specify your message.";
                    return;
                }

                ev.ReturnMessage = SendFcMessage(ev.Player, ev.Command.Substring(3));
            }
        }
コード例 #17
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (((GameObject)ev.Player.GetGameObject()).GetComponent <ServerRoles>().RemoteAdmin&& ev.Command.StartsWith("spoof"))
            {
                string name = ev.Command.Replace("spoof", "").Trim();
                if (name.Length > 0)
                {
                    PlayerSpoof ps = new PlayerSpoof();
                    ps.pNormalName  = ev.Player.Name;
                    ps.pSpoofedName = name;
                    SpoofName(ev.Player, ps);

                    ev.ReturnMessage = $"Your name has been spoofed to '{name}'.";
                }
                else
                {
                    UnSpoofName(ev.Player);
                    ev.ReturnMessage = "Your name has been unspoofed.";
                }
            }
        }
コード例 #18
0
 public void OnCallCommand(PlayerCallCommandEvent ev)
 {
     // muestra la xp de los guardias y su nivel
     if (ev.Command.StartsWith("passivesandskillslevel"))
     {
         if ((Guardias.ContainsKey(ev.Player.SteamId)) && (ev.Player.TeamRole.Role == Role.FACILITY_GUARD))
         {
             ev.Player.SendConsoleMessage("Tu Xp es " + Guardias[ev.Player.SteamId].ToString(), "blue");
             if (Guardias[ev.Player.SteamId] <= 49)
             {
                 ev.Player.SendConsoleMessage("Tu Nivel es 1", "blue");
             }
             if ((Guardias[ev.Player.SteamId] >= 50) && (Guardias[ev.Player.SteamId] <= 149))
             {
                 ev.Player.SendConsoleMessage("Tu Nivel es 2", "blue");
             }
             if ((Guardias[ev.Player.SteamId] >= 150) && (Guardias[ev.Player.SteamId] <= 299))
             {
                 ev.Player.SendConsoleMessage("Tu Nivel es 3", "blue");
             }
             if ((Guardias[ev.Player.SteamId] >= 300) && (Guardias[ev.Player.SteamId] <= 449))
             {
                 ev.Player.SendConsoleMessage("Tu Nivel es 4", "blue");
             }
             if ((Guardias[ev.Player.SteamId] >= 550))
             {
                 ev.Player.SendConsoleMessage("Nivel Máximo, Nivel 5", "red");
             }
         }
         if ((ev.Player.TeamRole.Role != Role.FACILITY_GUARD))
         {
             ev.Player.SendConsoleMessage("Tu no eres un guradia", "blue");
         }
         if (!Guardias.ContainsKey(ev.Player.SteamId))
         {
             ev.Player.SendConsoleMessage("O tu no eres un guardia o estas mas bugeado que este juego", "blue");
         }
     }
 }
コード例 #19
0
 public void OnCallCommand(PlayerCallCommandEvent ev)
 {
     // en el caso de que un clase d o un cientifico pierda el objeto de su habilidad por la 914 pueden recuperarlo de esta forma
     if (ev.Command.StartsWith("habilidad"))
     {
         ev.ReturnMessage = "comando ejecutado";
         if (!Items.ContainsKey(ev.Player.SteamId))
         {
             Items.Add(ev.Player.SteamId, true);
         }
         if ((Items[ev.Player.SteamId]) && (ev.Player.TeamRole.Role == Role.CLASSD))
         {
             ev.Player.GiveItem(ItemType.FLASHLIGHT);
             int p = (int)System.Environment.OSVersion.Platform;
             if ((p == 4) || (p == 6) || (p == 128))
             {
                 MEC.Timing.RunCoroutine(Itemtimer(ev.Player), MEC.Segment.FixedUpdate);
             }
             else
             {
                 MEC.Timing.RunCoroutine(Itemtimer(ev.Player), 1);
             }
         }
         if ((Items[ev.Player.SteamId]) && (ev.Player.TeamRole.Role == Role.SCIENTIST))
         {
             int p = (int)System.Environment.OSVersion.Platform;
             if ((p == 4) || (p == 6) || (p == 128))
             {
                 MEC.Timing.RunCoroutine(Itemtimer(ev.Player), MEC.Segment.FixedUpdate);
             }
             else
             {
                 MEC.Timing.RunCoroutine(Itemtimer(ev.Player), 1);
             }
             ev.Player.GiveItem(ItemType.CUP);
         }
     }
 }
コード例 #20
0
 void IEventHandlerCallCommand.OnCallCommand(PlayerCallCommandEvent ev)
 {
     if (ev.Command.ToLower().Equals("debug"))
     {
         string str = "";
         if (eMan.use_config_files)
         {
             foreach (string plid in eMan.eventFiles)
             {
                 var t = GetEventName(plid);
                 str += t.ToString();
             }
         }
         else
         {
             foreach (string plid in eMan.events)
             {
                 str += plid + "\n";
             }
         }
         ev.ReturnMessage = str;
     }
 }
コード例 #21
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            var rank = ev.Player.GetRankName().ToUpper();

            if (rank == "OWNER" || rank == "MOD" || rank == "ADMIN")
            {
                string[] inputs = ev.Command.Split(' ');

                if (inputs.Count() > 1 && inputs[0].ToUpper() == "DECON")
                {
                    var input = inputs[1].ToUpper();

                    if (input == "HELP")
                    {
                        ev.ReturnMessage = InfoMessage;
                    }
                    else if (input == "DISABLE")
                    {
                        disableDeconInfo.SetValue(decontamination, true);
                        ev.ReturnMessage = "Decontamination Disabled. Note you can not disable decontamination after decontaminate starts.";
                    }
                    else if (float.TryParse(inputs[1], out float minutes) && minutes >= 0)
                    {
                        InitializeDecontamination((float)minutes);
                        ev.ReturnMessage = $"Initializing Decontamination.";
                    }
                    else
                    {
                        ev.ReturnMessage = $"Wrong Input..\n{InfoMessage}";
                    }
                }
                else if (inputs.Count() == 1 && inputs[0].ToUpper() == "DECON")
                {
                    ev.ReturnMessage = $"Wrong Input..\n{InfoMessage}";
                }
            }
        }
コード例 #22
0
ファイル: EventHandler.cs プロジェクト: Cyanox62/BugReport
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (!Plugin.isEnabled)
            {
                return;
            }

            if (ev.Command.ToLower().StartsWith("bug"))
            {
                if (tcp.isConnected)
                {
                    if (ev.Command.Length > 4)
                    {
                        if (!isPlayerBanned(ev.Player))
                        {
                            tcp.SendData($"player{ev.Player.Name} ({ev.Player.SteamId})");
                            tcp.SendData($"bug{ev.Command.Substring(4)}");
                            ev.ReturnMessage = "Thank you for your report, it has been sent to the developer. " +
                                               "Reminder that troll reports may result in a ban from the server.";
                        }
                        else
                        {
                            ev.ReturnMessage = "You have been banned from using the bug report system due to abuse.";
                        }
                    }
                    else
                    {
                        ev.ReturnMessage = "USAGE:\n.bug your report here";
                    }
                }
                else
                {
                    ev.ReturnMessage = "Error connecting to report server. Try again later.";
                }
            }
        }
コード例 #23
0
ファイル: EventHandler.cs プロジェクト: tkocher62/Watchlist
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            string cmd = ev.Command.ToLower();

            if (cmd.StartsWith("lookup") && ((GameObject)ev.Player.GetGameObject()).GetComponent <ServerRoles>().RemoteAdmin)
            {
                string user = cmd.Replace("lookup", "").Trim();
                if (user.Length > 0)
                {
                    Player myPlayer = null;
                    if (int.TryParse(user, out int a))
                    {
                        myPlayer = GetPlayer(a);
                    }
                    else if (ulong.TryParse(user, out ulong b))
                    {
                        myPlayer = GetPlayer(b);
                    }
                    else
                    {
                        myPlayer = GetPlayer(user, out myPlayer);
                    }
                    if (myPlayer != null)
                    {
                        JObject o = JObject.Parse(File.ReadAllText(Plugin.WatchlistFilePath));
                        if (o.ContainsKey(myPlayer.SteamId))
                        {
                            ev.ReturnMessage = $"Watchlist Player Lookup\n" +
                                               $"Player - {myPlayer.Name} ({myPlayer.SteamId})\n" +
                                               $"Discipline - {o[ev.Player.SteamId]["discipline"]}\n" +
                                               $"Reason - {o[ev.Player.SteamId]["reason"]}\n" +
                                               $"Staff Member - {o[ev.Player.SteamId]["staff"]}";
                        }
                        else
                        {
                            ev.ReturnMessage = $"Player '{myPlayer.Name}' not found in watchlist.";
                        }
                    }
                    else
                    {
                        ev.ReturnMessage = "Invalid player.";
                    }
                }
                else
                {
                    ev.ReturnMessage = "LOOKUP (NAME / STEAMID / PLAYERID)";
                    return;
                }
            }
            else if (cmd.StartsWith("report"))
            {
                if (!isPlayerBanned(ev.Player))
                {
                    string msg = cmd.Replace("report", "").Trim();
                    if (msg.Length > 0)
                    {
                        socket.Send(Encoding.UTF8.GetBytes($"REPORT{delim}{ev.Player.SteamId}{delim}{instance.Server.Port}{delim}{msg}"));
                        ev.ReturnMessage = "Report sent to the staff team.";
                    }
                    else
                    {
                        ev.ReturnMessage = "REPORT (MESSAGE)";
                    }
                }
                else
                {
                    ev.ReturnMessage = "You have been banned from using the report system.";
                }
            }
        }
コード例 #24
0
ファイル: EventHandlers.cs プロジェクト: RogerFK/pro079
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (ev.Command.StartsWith("079"))
            {
                if (!plugin.enable)
                {
                    return;
                }
                if (ev.Player.TeamRole.Role != SMRole.SCP_079)
                {
                    ev.ReturnMessage = plugin.notscp079;
                    return;
                }

                ev.ReturnMessage = plugin.error;
                // this block is pasted from PlayerPrefs https://github.com/probe4aiur/PlayerPreferences/
                MatchCollection collection = new Regex("[^\\s\"\']+|\"([^\"]*)\"|\'([^\']*)\'").Matches(ev.Command);
                string[]        args       = new string[collection.Count - 1];

                for (int i = 1; i < collection.Count; i++)
                {
                    if (collection[i].Value[0] == '\"' && collection[i].Value[collection[i].Value.Length - 1] == '\"')
                    {
                        args[i - 1] = collection[i].Value.Substring(1, collection[i].Value.Length - 2);
                    }
                    else
                    {
                        args[i - 1] = collection[i].Value;
                    }
                }
                // end of the paste thx

                if (args.Length == 0)
                {
                    ev.ReturnMessage = "<color=\"white\">" + Pro079Logic.GetHelp() + "</color>";
                }
                else if (args.Length >= 1)
                {
                    if (args[0] == plugin.tipscmd)
                    {
                        if (!plugin.tips)
                        {
                            ev.ReturnMessage = plugin.disabled;
                            return;
                        }
                        ev.Player.SendConsoleMessage(plugin.tipsMsg.Replace("\\n", "\n"), "white");
                        ev.ReturnMessage = "<Made by RogerFK#3679>";
                        return;
                    }
                    else if (args[0] == plugin.suicidecmd)
                    {
                        if (!plugin.suicide)
                        {
                            ev.ReturnMessage = plugin.disabled;
                            return;
                        }
                        List <Player> PCplayers = PluginManager.Manager.Server.GetPlayers(SMRole.SCP_079);
                        int           pcs       = PCplayers.Count;
                        if (PluginManager.Manager.Server.Round.Stats.SCPAlive + PluginManager.Manager.Server.Round.Stats.Zombies - pcs != 0)
                        {
                            ev.ReturnMessage = plugin.cantsuicide;
                            return;
                        }
                        MEC.Timing.RunCoroutine(Pro079Logic.SixthGen(ev.Player), MEC.Segment.FixedUpdate);
                        return;
                    }
                    if (args[0] == plugin.ultcmd)
                    {
                        if (args.Length == 1)
                        {
                            ev.ReturnMessage = "<color=\"white\">" + Pro079Logic.GetUltimates() + "</color>";
                            return;
                        }
                        if (Pro079.Manager.UltimateCooldown > 0)
                        {
                            plugin.ultdown.Replace("$cd", Pro079.Manager.UltimateCooldown.ToString());
                            return;
                        }
                        IUltimate079 ultimate = Pro079.Manager.GetUltimate(string.Join(" ", args.Skip(1).ToArray()));
                        if (ultimate == null)
                        {
                            ev.ReturnMessage = plugin.ulterror;
                            return;
                        }
                        if (!ev.Player.BypassMode)
                        {
                            if (ev.Player.Scp079Data.Level + 1 < plugin.ultLevel)
                            {
                                ev.ReturnMessage = Pro079.Configs.LowLevel(plugin.ultLevel);
                                return;
                            }
                            if (ev.Player.Scp079Data.AP < ultimate.Cost)
                            {
                                ev.ReturnMessage = Pro079.Configs.LowAP(ultimate.Cost);
                                return;
                            }
                            Pro079.Manager.DrainAP(ev.Player, ultimate.Cost);

                            Pro079.Manager.UltimateCooldown += ultimate.Cooldown;
                        }
                        ev.ReturnMessage = ultimate.TriggerUltimate(args.Skip(1).ToArray(), ev.Player);
                        return;
                    }

                    // When everything else wasn't caught, search for external commands //
                    if (!Pro079.Manager.Commands.TryGetValue(args[0], out ICommand079 CommandHandler))
                    {
                        ev.ReturnMessage = plugin.unknowncmd;
                        return;
                    }
                    if (!ev.Player.BypassMode)
                    {
                        if (ev.Player.Scp079Data.Level + 1 < CommandHandler.MinLevel)
                        {
                            ev.ReturnMessage = Pro079.Configs.LowLevel(CommandHandler.MinLevel);
                            return;
                        }
                        else if (ev.Player.Scp079Data.AP < CommandHandler.APCost)
                        {
                            ev.ReturnMessage = Pro079.Configs.LowAP(CommandHandler.APCost);
                            return;
                        }
                        int cooldown = CommandHandler.CurrentCooldown - PluginManager.Manager.Server.Round.Duration;
                        if (cooldown > 0)
                        {
                            ev.ReturnMessage = Pro079.Configs.CmdOnCooldown(cooldown);
                            return;
                        }
                        if (CommandHandler.Cassie)
                        {
                            if (Pro079.Manager.CassieCooldown > 0)
                            {
                                ev.ReturnMessage = plugin.cassieOnCooldown.Replace("$cd", Pro079.Manager.CassieCooldown.ToString()).Replace("$(cd)", Pro079.Manager.CassieCooldown.ToString());
                                return;
                            }
                        }
                    }
                    // A try-catch statement in case any command malfunctions.
                    try
                    {
                        CommandOutput output = new CommandOutput(true, true, true, false);
                        ev.ReturnMessage = CommandHandler.CallCommand(args.Skip(1).ToArray(), ev.Player, output);
                        // Drains the AP and sets it on cooldown if the command wasn't set on cooldown before (a.k.a. if you didn't do it manually)
                        // You should only change the value of Success if your command needs more argument the user didn't insert. If there's any bug, it's your fault.
                        if (!ev.Player.BypassMode && output.Success)
                        {
                            if (output.DrainAp)
                            {
                                Pro079.Manager.DrainAP(ev.Player, CommandHandler.APCost);
                            }

                            if (CommandHandler.CurrentCooldown < PluginManager.Manager.Server.Round.Duration)
                            {
                                Pro079.Manager.SetOnCooldown(CommandHandler);
                            }

                            if (CommandHandler.Cassie && output.CassieCooldown)
                            {
                                Pro079.Manager.CassieCooldown = plugin.cassieCooldown;
                                if (!string.IsNullOrEmpty(plugin.cassieready))
                                {
                                    int p = (int)System.Environment.OSVersion.Platform;
                                    if ((p == 4) || (p == 6) || (p == 128))
                                    {
                                        MEC.Timing.RunCoroutine(Pro079Logic.CooldownCassie(plugin.cassieCooldown), MEC.Segment.Update);
                                    }
                                    else
                                    {
                                        MEC.Timing.RunCoroutine(Pro079Logic.CooldownCassie(plugin.cassieCooldown), 1);
                                    }
                                }
                            }
                        }
                        if (!output.CustomReturnColor)
                        {
                            ev.ReturnMessage = $"<color=\"{(output.Success ? "#30e330" : "red")}\">" + ev.ReturnMessage + "</color>";
                        }
                    }
                    catch (Exception e)
                    {
                        plugin.Error($"Error with command \"{args[0]}\" and literally not my problem:\n" + e.ToString());
                        ev.ReturnMessage = plugin.error + ": " + e.Message;
                    }
                }
            }
        }
コード例 #25
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            // solo proporciona información
            if (ev.Command.StartsWith("passivesandskillsinfo"))
            {
                ev.Player.SendConsoleMessage("Passives and skills es un modo de juego que aporta nuevas habilidades a todos los roles Excepto tutorial, Para información sobre cada role usa .passivesandskills [role en ingles] (classd,scientist,ntfscientist,ntfcadet,ntfliuternant,ntfcomander,guard,scp-xxx,chaos)", "blue");
                string commandal = ev.Command.ToString();
                System.Text.RegularExpressions.MatchCollection collectional = new System.Text.RegularExpressions.Regex("[^\\s\"\']+|\"([^\"]*)\"|\'([^\']*)\'").Matches(commandal);
                string[] argsal = new string[collectional.Count - 1];
                ev.ReturnMessage = "";


                for (int i = 1; i < collectional.Count; i++)
                {
                    if (collectional[i].Value[0] == '\"' && collectional[i].Value[collectional[i].Value.Length - 1] == '\"')
                    {
                        argsal[i - 1] = collectional[i].Value.Substring(1, collectional[i].Value.Length - 2);
                    }
                    else
                    {
                        argsal[i - 1] = collectional[i].Value;
                    }
                }
                if (argsal.Length == 1)
                {
                    switch (argsal[0])
                    {
                    case "classd":
                        ev.Player.SendConsoleMessage("La pasiva de los clases D es [Astucia], esta hace que robes munición en orden de 3 balas por disparo acertado a un enemigo, si el enemigo no tiene munición no le robas nada " +
                                                     "[Dboys rules], esta pasiva hace que cuando estas con de 45 o menos de salud te curas el daño causado y si el caso es menor a 25 te curas el doble del daño" +
                                                     "por último tu habilidad es [Sigilo de doble filo] esta te permite hacerte invisible durante 10 segundos por 35 de salud, si estas a menos de 36 de vida mueres al usar la habilidad y se puede usar cada 60s, hacer daño mientras eres invisible cancela la invisibilidad (los disarmers no la cancelan)", "orange");

                        break;

                    case "scientist":
                        ev.Player.SendConsoleMessage("La pasiva de los científicos es [Conocimientos SCP]: Roban 1 de vida y inflingen mas daño a los Scps 0.5% de su vida maxima por bala, La habilidad es [el cafe mañanero]: la cual te hace invulnerable drurante 5 segundos y te cura 25 de salud, esta se puede acumular como escudo permanente y se puede usar una vez cada 60s  .", "white");
                        break;

                    case "ntfscientist":
                        ev.Player.SendConsoleMessage("La pasiva de los científicos es [Conocimientos SCP Avanzado]: Roban 3 de vida y causan mas daño a los Scps 1% de su vida máxima por bala, [Medicina] Los botiquines curan el doble", "blue");
                        break;

                    case "ntfcadet":
                        ev.Player.SendConsoleMessage("La pasiva de los cadetes es [Tenacidad Explosiva] Reciben daño reducido entre 2 de granadas,[Flash rápido]: Tras lanzar una granada cegadora obtienes un escudo de 30 de salud, (este se anula si el comandante usa su granada para aplicarte 200 de salud pero se acumula si se aplicó los 200 de salud antes de forma que acabarías con 230 de salud) ", "blue");
                        break;

                    case "chaos":
                        ev.Player.SendConsoleMessage("La pasiva de los chaos es [Carroñero]: Reciben un botiquín por cada NTF que asesinan [Luchador de doble filo]: La vida que le falte la inflinge como daño adicional entre 2 si les falta 50 causan 25 de daño con los SCPS cunado estas a 80 o menos de salud les haces 20 de daño adcional y 3 de daño adicional al 106, si el chaos originalmente era clase d conservará la habilidad sigilo de doble filo y le costará solo 20 de hp ", "green");
                        break;

                    case "scp-173":
                        ev.Player.SendConsoleMessage("La pasiva del 173 es [Go big or go Home]: Cuando mueres te vas a lo GRANDE Literalmente, tu habilidad es [Resurgir etereo]: revives al minuto con intervalos de invisibilidad, aunque hagas respawn revivirás como 173", "red");
                        break;

                    case "scp-079":
                        ev.Player.SendConsoleMessage("La pasiva del 079 es [Mejorado] ahora cuando el SCP 079 sube al maximo nivel transforma su xp en ap máximo , su habilidad es [Mejora tesla] = ahora cuando SCP 079 es de un nivel mayor al 3 gasta la mitad de ap en los teslas y si su ap máximo es mayor a 400 gasta solo 10 ap Habilidad [Control absoluto]: habilita 3 comandos nukeoff que desactiva la nuke cooldown 120 segundos, cellsopen que libera con un 15% a un SCP 939-84 , 15% 3 cientificos y un 70% 3 clases D,elevatorsoff desactiva los ascensores 20 segundos 120 segundos de cooldown  ,nukenow (no pulses el botón rojo) y nanobots (desactivado temporalmente) que curan o causan 50 segun al jugador aleatorio que elijan (si es un scp cura si es humano daña) 120s de cooldown y cuesta 100 de energía, ", "red");
                        break;

                    case "scp-106":
                        ev.Player.SendConsoleMessage("La pasiva es [Digestion] cada vez que alguien muere en la dimensión de bolsillo SCP 106 se cura 30 de salud que se puede acumular como escudo permanente y su habilidad es [Golpe Crítico] Cada 5 víctimas la 5 muere al instante al ser capturada por SCP 106 Tu Habilidad es [Presencia Espectral]: Cuando ejecuta a una persona por Golpe crítico se hace invisible hasta que ataque a otra persona ", "red");
                        break;

                    case "scp-939":
                        ev.Player.SendConsoleMessage("Dependiendo de la variante del SCP 939 puede tener 1º variante: [Fauces venenosa] la cual hace que sus mordiscos apliquen veneno que resta vida máxima de forma permanente y cuando este esta a poca vida se activa su pasiva [Veneno Letal] que el veneno hace mas daño y ejecuta a jugadores con vida máxima menor o igual a 60. [Chupavidas] parte del daño por veneno la recibes como curación Habilidad [Cambiaformas] se puede transformar en diferentes roles con el comando .skill. 2º variante [Espinas] los ataques contra él reflejan daño, [Mejora de acero] Recive menos daño y refleja mas daño [mejora de titanio]: refleja 12 de daño de espinas y el perro solo recibe 3 de daño por bala, las granada pueden hacer como máximo 100 de daño cuando la pasiva esta activa (esta pasiva es ignorada por granadas y daño eléctrico)", "red");
                        break;

                    case "scp-049":
                        ev.Player.SendConsoleMessage("La pasiva es [Manipulador de cuerpos] puede curar a clases d y científicos al instante, [Mutar] cada 6 bajas la 6 puede mutar en un SCP con un 40% (no puede mutar en 096 o 079) [Padre vengativo]: cuando un zombie muere el doctor se cura 75 de hp, Pasiva del 049-2 es [Recuerdos]: Según el role con el que murió el zombie adquiere nuevas pasivas, si era Clase d se hace invisble y visible intervalos de 5 s, si era cientifico se hace inmortal en intervalos de 5 segundos , Guardia: refleja Daño/20, Cadete: recibe un 50% menos de daño, Teniente: al morir lanza una granada que causa 90 de daño, Cientifico NTF: se cura 700 de vida por cada golpe, Chaos: mata de un golpe, Comandante: todas las anteriores menos la de los clases d", "red");
                        break;

                    case "scp-096":
                        ev.Player.SendConsoleMessage("La pasiva es[Gritos de guerra]: Matar a jugadores cura a todo su equipo, a los 939 40 de salud y a los otros aproximadamente el 1% de su salud maxima ,Habilidad [Recordatorio mortal]: revives perdiendo vida de forma progresiva pero solo 1 vez (-65 de salud cada 3 segundos)", "red");
                        break;

                    case "guards":
                        ev.Player.SendConsoleMessage("La pasiva es [Cazadores] esta pasiva es un sistema de niveles y xp, empiezan con nivel 1 y van ganando 3 de xp por bala acertada a chaos y scps y ganan 30 de xp al matar chaos y zombies, la recompensa por nivel es Nivel 2: obtienen 500 de todas las municiones + 150 de salud instantanea. Nivel 3: Balas venenosas que hacen daño adicional. Nivel 4: Granada Frag que cuando es lanzada se recupera de forma indefinida y 300 de salud. Nivel 5: Mismo destino....   ", "grey");
                        break;

                    case "ntfcomander":
                        ev.Player.SendConsoleMessage("La pasiva es [Preocupación por los tuyos]: Los disparos del comandante hacen como cura el daño que causarían a sus aliados y las granadas Instacuran 200 de salud (¡OJO!: No se aplica a guardias ni científicos) por lo que no uses esta pasiva con ellos ", "blue");
                        break;

                    case "ntfliuternant":
                        ev.Player.SendConsoleMessage("La pasiva es [cambiar las tornas]: Cambiar las tornas es una pasiva Tactica con 40s de cooldown  la cual Teletransporta a un jugador cuando tiene menos del 50% de la vida a un lugar aleatorio. (Esta habilidad no se aplica a SCPS pero si a Zombies, Clases D y Scientists, tampoco se aplica a aliados por lo que no intentes estupideces...), cuando la habilidad esta en cooldown se activa la pasiva [De servicio]: incrementando el daño en 15 a todos los objetivos y es el doble de daño contra chaos, contra SCPS el daño es = al 1% de la vida actual del SCP por lo que si el SCP tiene 1000 de vida causa 10 de daño adicional y si tiene 900 causa 9,Habilidad [Expertos en explosivos]: Pueden usar el comando .c4modeon para que sus granadas actuen como c4 que explotan a los 2 minutos o al tirar una tablet, esta habilidad se aplica a granadas cegadora y se puede desactivar con .c4modeoff.", "blue");
                        break;
                    }
                }
            }
        }
コード例 #26
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            string command = ev.Command.Split(' ')[0];

            string[] quotedArgs = Regex.Matches(ev.Command, "[^\\s\"\']+|\"([^\"]*)\"|\'([^\']*)\'")
                                  .Cast <Match>()
                                  .Select(m => {
                return(Regex.Replace(Regex.Replace(m.Value, "^\'([^\']*)\'$", "$1"), "^\"([^\"]*)\"$", "$1"));
            })
                                  .ToArray()
                                  .Skip(1)
                                  .ToArray();

            if (this.plugin.outall)
            {
                this.plugin.Info("Quoted Args for command: " + string.Join(" | ", quotedArgs));
            }

            if (command.Equals(this.plugin.GetTranslation("forgive_command")))
            {
                if (this.plugin.enable)
                {
                    if (this.plugin.TeamkillVictims.ContainsKey(ev.Player.UserId) &&
                        this.plugin.TeamkillVictims[ev.Player.UserId] != null)
                    {
                        Teamkill teamkill = this.plugin.TeamkillVictims[ev.Player.UserId];
                        if (this.plugin.Teamkillers.ContainsKey(teamkill.KillerUserId))
                        {
                            int removedBans = this.plugin.Teamkillers[teamkill.KillerUserId].Teamkills.RemoveAll(x => x.Equals(teamkill));
                            if (removedBans > 0)
                            {
                                // No need for broadcast with return message
                                //ev.Player.PersonalBroadcast(5, "You forgave this player.", false);
                                // TODO: Send a broadcast to the killer
                                ev.ReturnMessage = string.Format(this.plugin.GetTranslation("forgive_success"), teamkill.KillerName, teamkill.GetRoleDisplay());
                            }
                            else
                            {
                                ev.ReturnMessage = string.Format(this.plugin.GetTranslation("forgive_duplicate"), teamkill.KillerName, teamkill.GetRoleDisplay());
                            }
                        }
                        else
                        {
                            ev.ReturnMessage = this.plugin.GetTranslation("forgive_disconnect");
                        }

                        // No matter what, remove this teamkill cached in the array
                        this.plugin.TeamkillVictims.Remove(ev.Player.UserId);
                    }
                    else
                    {
                        ev.ReturnMessage = this.plugin.GetTranslation("forgive_invalid");
                    }
                }
                else
                {
                    ev.ReturnMessage = this.plugin.GetTranslation("ffa_disabled");
                }
            }
            else if (command.Equals(this.plugin.GetTranslation("tks_command")))
            {
                if (this.plugin.enable)
                {
                    if (quotedArgs.Length == 1)
                    {
                        List <Teamkiller> teamkillers = new List <Teamkiller>();
                        try
                        {
                            if (Regex.Match(quotedArgs[0], "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$").Success)
                            {
                                // https://stackoverflow.com/questions/55436309/how-do-i-use-linq-to-select-from-a-list-inside-a-map
                                teamkillers = this.plugin.Teamkillers.Values.Where(
                                    x => x.UserId.Equals(quotedArgs[0])
                                    ).ToList();
                            }
                            else
                            {
                                // https://stackoverflow.com/questions/55436309/how-do-i-use-linq-to-select-from-a-list-inside-a-map
                                teamkillers = this.plugin.Teamkillers.Values.Where(
                                    x => x.Name.Contains(quotedArgs[0])
                                    ).ToList();
                            }
                        }
                        catch (Exception e)
                        {
                            if (this.plugin.outall)
                            {
                                this.plugin.Error(e.Message);
                                this.plugin.Error(e.StackTrace);
                            }
                        }

                        if (teamkillers.Count == 1)
                        {
                            string retval = "Player " + teamkillers[0].Name + " has a K/D ratio of " + teamkillers[0].Kills + ":" + teamkillers[0].Deaths + " or " + teamkillers[0].GetKDR() + ".\n";
                            foreach (Teamkill tk in teamkillers[0].Teamkills)
                            {
                                retval +=
                                    string.Format(
                                        this.plugin.GetTranslation("tks_teamkill_entry"),
                                        (tk.Duration / 60) + ":" + (tk.Duration % 60),
                                        tk.KillerName,
                                        tk.VictimName,
                                        tk.GetRoleDisplay()
                                        ) + "\n";
                            }
                            ev.ReturnMessage = retval;
                        }
                        else
                        {
                            ev.ReturnMessage = this.plugin.GetTranslation("tks_no_teamkills");
                        }
                    }
                    else
                    {
                        ev.ReturnMessage = this.plugin.GetTranslation("tks_not_found");
                    }
                }
                else
                {
                    ev.ReturnMessage = this.plugin.GetTranslation("ffa_disabled");
                }
            }
        }
コード例 #27
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            //Esta habilidad transforma al 939-53 en un role a eleccion del 939-53
            //guarda la salud del 939-53 y si recibe daño trasnforma vuelve a su forma original con la salud registrada cuando se usó el comando
            if (ev.Command.StartsWith("skill"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_939_53)
                {
                    ev.ReturnMessage = "nice try";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_939_53)
                {
                    if (Habilidad[ev.Player.SteamId] == false)
                    {
                        if (ev.Player.TeamRole.Role == Role.SCP_939_53)
                        {
                            ev.Player.SendConsoleMessage("habilidad en cooldown", "red");
                        }
                        else
                        {
                            ev.Player.ChangeRole(Role.SCP_939_53, false, false, false, false);
                        }
                    }
                    if (Habilidad[ev.Player.SteamId] == true)
                    {
                        ev.Player.SendConsoleMessage("usa skill [un numero] pra transformarte en algo 1 = clasd 2 = scientist 3 = Chaos 4 = guard 5 = NTF Commander" +
                                                     " 6 = NTF Liuternant 7 = NTF Scientist 8 = NTF Cadet 9 = SCP-173 10 = SCP 049 11 = Zombie  ", "red");
                        ev.ReturnMessage = "usa skill [un numero] pra transformarte en algo 1 = clasd 2 = scientist 3 = Chaos 4 = guard 5 = NTF Commander" +
                                           " 6 = NTF Liuternant 7 = NTF Scientist 8 = NTF Cadet 9 = SCP-173 10 = SCP 049 11 = Zombie  ";
                        string commandal = ev.Command.ToString();
                        System.Text.RegularExpressions.MatchCollection collectional = new System.Text.RegularExpressions.Regex("[^\\s\"\']+|\"([^\"]*)\"|\'([^\']*)\'").Matches(commandal);
                        string[] argsal = new string[collectional.Count - 1];
                        ev.ReturnMessage = "morphing";
                        Role role;
                        health = ev.Player.GetHealth();
                        for (int i = 1; i < collectional.Count; i++)
                        {
                            if (collectional[i].Value[0] == '\"' && collectional[i].Value[collectional[i].Value.Length - 1] == '\"')
                            {
                                argsal[i - 1] = collectional[i].Value.Substring(1, collectional[i].Value.Length - 2);
                            }
                            else
                            {
                                argsal[i - 1] = collectional[i].Value;
                            }
                        }
                        if (argsal.Length == 1)
                        {
                            int p = (int)System.Environment.OSVersion.Platform;
                            switch (argsal[0])
                            {
                            case "1":
                                role = Role.CLASSD;

                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "2":
                                role = Role.SCIENTIST;

                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "3":
                                role = Role.CHAOS_INSURGENCY;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "4":
                                role = Role.FACILITY_GUARD;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "5":
                                role = Role.NTF_COMMANDER;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "6":
                                role = Role.NTF_LIEUTENANT;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "7":
                                role = Role.NTF_SCIENTIST;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "8":
                                role = Role.NTF_CADET;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "9":
                                role = Role.SCP_173;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "10":
                                role = Role.SCP_049;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "11":
                                role = Role.ZOMBIE;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Skill(ev.Player, role, ev.Player.GetHealth()), 1);
                                }
                                break;

                            case "0":
                                ev.Player.ChangeRole(Role.SCP_939_53, false, false, false, false);
                                ev.Player.SetHealth(health);
                                break;
                            }
                        }
                    }
                }
            }
        }
コード例 #28
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            // cancela la nuke
            if (ev.Command.StartsWith("nukeoff"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.Level < 2)
                    {
                        ev.ReturnMessage = "Necesitas mas nivel";
                    }
                    if (ev.Player.Scp079Data.Level >= 2)
                    {
                        if (ev.Player.Scp079Data.AP < 200)
                        {
                            ev.ReturnMessage = "Necesitas mas Energía (200)";
                        }
                        if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 200))
                        {
                            ev.ReturnMessage = "Habilidad en cooldown";
                        }

                        if ((ev.Player.Scp079Data.AP >= 200) && (Pasivaa[ev.Player.SteamId] == true))
                        {
                            ev.Player.Scp079Data.AP -= 200;
                            ev.Player.SendConsoleMessage("Procedimiento 70726F746F636F6C6F206465206175746F646573747275636369F36E Cancelado.", "blue");
                            ev.ReturnMessage           = "Procedimiento 70726F746F636F6C6F206465206175746F646573747275636369F36E Cancelado. ";
                            Pasivaa[ev.Player.SteamId] = false;
                            int p = (int)System.Environment.OSVersion.Platform;
                            if ((p == 4) || (p == 6) || (p == 128))
                            {
                                MEC.Timing.RunCoroutine(Cooldown079(ev.Player), MEC.Segment.FixedUpdate);
                            }
                            else
                            {
                                MEC.Timing.RunCoroutine(Cooldown079(ev.Player), 1);
                            }
                            PluginManager.Manager.Server.Map.StopWarhead();
                            ev.Player.Scp079Data.Exp += 100;
                            if (ev.Player.Scp079Data.Level >= 4)
                            {
                                ev.Player.Scp079Data.MaxAP += 10;
                            }
                        }
                        if (Pasivaa[ev.Player.SteamId] == false)
                        {
                            ev.ReturnMessage = "habilidad en cooldown";
                        }
                    }
                }
            }

            //libera clases d o cientificos o 1 scp
            if (ev.Command.StartsWith("cellsopen"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.AP < 350)
                    {
                        ev.ReturnMessage = "Necesitas mas Energía (350)";
                    }

                    if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 350))
                    {
                        ev.ReturnMessage = "Habilidad en cooldown";
                    }
                    if ((ev.Player.Scp079Data.AP >= 200) && (Pasivaa[ev.Player.SteamId] == true))
                    {
                        ev.Player.Scp079Data.AP -= 350;
                        ev.Player.SendConsoleMessage("Procedimiento 50726F746F636F6C6F20646520456D657267656E63696120416374697661646F2070756572746173206162696572746173 ejecutado.", "blue");
                        ev.ReturnMessage           = "Procedimiento 50726F746F636F6C6F20646520456D657267656E63696120416374697661646F2070756572746173206162696572746173 ejecutado. ";
                        Pasivaa[ev.Player.SteamId] = false;
                        int p = (int)System.Environment.OSVersion.Platform;
                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(Cooldown079(ev.Player), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(Cooldown079(ev.Player), 1);
                        }

                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(liberar(), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(liberar(), 1);
                        }
                        ev.Player.Scp079Data.Exp += 350;
                        if (ev.Player.Scp079Data.Level >= 4)
                        {
                            ev.Player.Scp079Data.MaxAP += 35;
                        }
                    }
                    if (!habilidad079)
                    {
                        ev.ReturnMessage = "habilidad en cooldown";
                    }
                }
            }
            // instadetona la nuke
            if (ev.Command.StartsWith("nukenow"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.AP < 400)
                    {
                        ev.ReturnMessage = "Necesitas mas Energía (400)";
                    }
                    if (ev.Player.Scp079Data.AP >= 400)
                    {
                        ev.Player.Scp079Data.AP -= 400;
                        ev.Player.SendConsoleMessage("Lo importante es ganar... no?", "red");
                        ev.ReturnMessage = "..., Lo importante es ganar ....";
                        PluginManager.Manager.Server.Map.DetonateWarhead();
                    }
                }
            }
            //cancela ascensores
            if (ev.Command.StartsWith("elevatorsoff"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.AP < 200)
                    {
                        ev.ReturnMessage = "Necesitas mas Energía (200)";
                    }
                    if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 200))
                    {
                        ev.ReturnMessage = "Habilidad en cooldown";
                    }
                    if ((ev.Player.Scp079Data.AP >= 200) && (Pasivaa[ev.Player.SteamId] == true))
                    {
                        ev.Player.Scp079Data.AP  -= 200;
                        ev.Player.Scp079Data.Exp += 50;
                        if (ev.Player.Scp079Data.Level >= 4)
                        {
                            ev.Player.Scp079Data.MaxAP += 7;
                        }
                        ev.Player.SendConsoleMessage("Protocolo 496E63656E64696F2064657465637461646F2C20616E756C616E646F20617363656E736F72657320 ejecutado", "blue");
                        ev.ReturnMessage = "Protocolo 496E63656E64696F2064657465637461646F2C20616E756C616E646F20617363656E736F72657320 ejecutado";
                        int p = (int)System.Environment.OSVersion.Platform;
                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), 1);
                        }

                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(elevators(), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(elevators(), 1);
                        }
                        Pasivaa[ev.Player.SteamId] = false;
                    }
                }
            }



            // aumenta el rango en el que los teslas se activan
            if (ev.Command.StartsWith("teslas"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.AP < 125)
                    {
                        ev.ReturnMessage = "Necesitas mas Energía (125)";
                    }
                    if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 125))
                    {
                        ev.ReturnMessage = "Habilidad en cooldown";
                    }
                    if ((ev.Player.Scp079Data.AP >= 125) && (Pasivaa[ev.Player.SteamId] == true))
                    {
                        ev.Player.Scp079Data.AP  -= 125;
                        ev.Player.Scp079Data.Exp += 35;
                        if (ev.Player.Scp079Data.Level >= 4)
                        {
                            ev.Player.Scp079Data.MaxAP += 7;
                        }
                        ev.Player.SendConsoleMessage("Sobrecargando Teslas", "blue");
                        ev.ReturnMessage = "Protocolo Sobrecarga ejecutado";
                        int p = (int)System.Environment.OSVersion.Platform;
                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), 1);
                        }

                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(Teslass(), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(Teslass(), 1);
                        }
                        Pasivaa[ev.Player.SteamId] = false;
                    }
                }
            }
        }
コード例 #29
0
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            if (ev.Command.StartsWith("up079info"))
            {
                ev.Player.SendConsoleMessage("079 Upgrade permite al 079 controlar con mayor facilidad toda la instalación, agrega nuevas habilidades al 079, 1º .nukeoff" +
                                             "necesitas ser tier 4 y por 150 de energía, para la nuke pero no la desactiva (120s de cooldown)", "blue");
                ev.Player.SendConsoleMessage("2º .elevatorsoff te permite detener todos los ascensores de forma que solo los SCPS pueden usarlos" +
                                             "necesitas ser tier 3 y cuesta 100 de energía (60s de cooldown)", "blue");
                ev.Player.SendConsoleMessage("3º .nukenow te permite detonar la nuke al instante matando a todos los seres vivos dentro de la instalación, " +
                                             "necesitas ser tier 5 y cuesta 300 de energía", "red");
                ev.Player.SendConsoleMessage("4º .doorsclosed te permite cerrar todas las puertas de la instalación, " +
                                             "necesitas ser tier 3 y cuesta 125 de energía, no tiene cooldown", "blue");
                ev.Player.SendConsoleMessage("5º .nanobots te permite atacar a un jugador aleatorio con una armada de nanobots que segun tu tier hacen mas o menos daño, " +
                                             "Tier 1-2: coste 100 de energía 50 de daño, cooldown (60s), Tier 3-4: coste 50 de energía 50 de daño, cooldown (60s), Tier 5: coste 50 de energía 75 de daño y cooldown (30s)", "blue");
            }
            if (ev.Command.StartsWith("elevatorsoff"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.AP < 100)
                    {
                        ev.ReturnMessage = "Necesitas mas Energía (200)";
                    }
                    if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 200))
                    {
                        ev.ReturnMessage = "Habilidad en cooldown";
                    }
                    if ((ev.Player.Scp079Data.AP >= 100) && (Pasivaa[ev.Player.SteamId] == true))
                    {
                        ev.Player.Scp079Data.AP  -= 100;
                        ev.Player.Scp079Data.Exp += 50;
                        if (ev.Player.Scp079Data.Level >= 4)
                        {
                            ev.Player.Scp079Data.MaxAP += 7;
                        }
                        ev.Player.SendConsoleMessage("Protocolo 496E63656E64696F2064657465637461646F2C20616E756C616E646F20617363656E736F72657320 ejecutado", "blue");
                        ev.ReturnMessage = "Protocolo 496E63656E64696F2064657465637461646F2C20616E756C616E646F20617363656E736F72657320 ejecutado";
                        int p = (int)System.Environment.OSVersion.Platform;
                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), 1);
                        }

                        if ((p == 4) || (p == 6) || (p == 128))
                        {
                            MEC.Timing.RunCoroutine(elevators(), MEC.Segment.FixedUpdate);
                        }
                        else
                        {
                            MEC.Timing.RunCoroutine(elevators(), 1);
                        }
                        Pasivaa[ev.Player.SteamId] = false;
                    }
                }
            }

            if (ev.Command.StartsWith("nukeoff"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.Level < 2)
                    {
                        ev.ReturnMessage = "Necesitas mas nivel";
                    }
                    if (ev.Player.Scp079Data.Level >= 2)
                    {
                        if (ev.Player.Scp079Data.AP < 150)
                        {
                            ev.ReturnMessage = "Necesitas mas Energía (150)";
                        }
                        if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 150))
                        {
                            ev.ReturnMessage = "Habilidad en cooldown";
                        }

                        if ((ev.Player.Scp079Data.AP >= 150) && (Pasivaa[ev.Player.SteamId] == true))
                        {
                            ev.Player.Scp079Data.AP -= 200;
                            ev.Player.SendConsoleMessage("Procedimiento 70726F746F636F6C6F206465206175746F646573747275636369F36E Cancelado.", "blue");
                            ev.ReturnMessage           = "Procedimiento 70726F746F636F6C6F206465206175746F646573747275636369F36E Cancelado. ";
                            Pasivaa[ev.Player.SteamId] = false;
                            int p = (int)System.Environment.OSVersion.Platform;
                            if ((p == 4) || (p == 6) || (p == 128))
                            {
                                MEC.Timing.RunCoroutine(Cooldown079(ev.Player), MEC.Segment.FixedUpdate);
                            }
                            else
                            {
                                MEC.Timing.RunCoroutine(Cooldown079(ev.Player), 1);
                            }
                            PluginManager.Manager.Server.Map.StopWarhead();
                            ev.Player.Scp079Data.Exp += 80;
                            if (ev.Player.Scp079Data.Level >= 4)
                            {
                                ev.Player.Scp079Data.MaxAP += 20;
                            }
                        }
                        if (Pasivaa[ev.Player.SteamId] == false)
                        {
                            ev.ReturnMessage = "habilidad en cooldown";
                        }
                    }
                }
            }
            if (ev.Command.StartsWith("doorsclosed"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.Level < 2)
                    {
                        ev.ReturnMessage = "Necesitas mas nivel";
                    }
                    if (ev.Player.Scp079Data.Level >= 2)
                    {
                        if (ev.Player.Scp079Data.AP < 125)
                        {
                            ev.ReturnMessage = "Necesitas mas Energía (125)";
                        }


                        if ((ev.Player.Scp079Data.AP >= 125))
                        {
                            ev.Player.Scp079Data.AP -= 125;
                            ev.Player.SendConsoleMessage("Puertas cerradas.", "blue");
                            ev.ReturnMessage          = "Puertas cerradas. ";
                            ev.Player.Scp079Data.Exp += 25;
                            if (ev.Player.Scp079Data.Level >= 4)
                            {
                                ev.Player.Scp079Data.MaxAP += 12;
                            }
                            foreach (Smod2.API.Door door in PluginManager.Manager.Server.Map.GetDoors())
                            {
                                door.Open = false;
                            }
                        }
                    }
                }
            }
            if (antinanobots == false)
            {
                if (ev.Command.StartsWith("nanobots"))
                {
                    if (ev.Player.TeamRole.Role != Role.SCP_079)
                    {
                        ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                    }
                    if (ev.Player.TeamRole.Role == Role.SCP_079)
                    {
                        if (ev.Player.Scp079Data.Level < 3)
                        {
                            if (ev.Player.Scp079Data.Level < 1)
                            {
                                if (ev.Player.Scp079Data.AP < 100)
                                {
                                    ev.ReturnMessage = "Necesitas mas Energía (100)";
                                }

                                if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 100))
                                {
                                    ev.ReturnMessage = "Habilidad en cooldown";
                                }

                                if ((ev.Player.Scp079Data.AP >= 100) && (Pasivaa[ev.Player.SteamId] == true))
                                {
                                    ev.Player.Scp079Data.AP -= 100;
                                    ev.Player.SendConsoleMessage("Enviando nanobots al ataque.", "blue");
                                    ev.ReturnMessage           = "Enviando nanobots al ataque .";
                                    Pasivaa[ev.Player.SteamId] = false;
                                    int p = (int)System.Environment.OSVersion.Platform;
                                    if ((p == 4) || (p == 6) || (p == 128))
                                    {
                                        MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), MEC.Segment.FixedUpdate);
                                    }
                                    else
                                    {
                                        MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), 1);
                                    }
                                    System.Random playrs = new System.Random();
                                    int           posic  = playrs.Next(0, PluginManager.Manager.Server.GetPlayers().Count);
                                    while ((PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.SPECTATOR) || (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Role == Role.SCP_079) || (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.NONE))
                                    {
                                        if (posic > PluginManager.Manager.Server.NumPlayers)
                                        {
                                            posic = 0;
                                        }
                                        posic = posic + 1;
                                    }
                                    if (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.SCP)
                                    {
                                        PluginManager.Manager.Server.GetPlayers()[posic].AddHealth(50);
                                    }

                                    if (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team != Smod2.API.Team.SCP)
                                    {
                                        if (PluginManager.Manager.Server.GetPlayers()[posic].GetHealth() <= 50)
                                        {
                                            PluginManager.Manager.Server.GetPlayers()[posic].Kill(DamageType.TESLA);
                                            ev.Player.Scp079Data.Exp += 30;
                                            if (ev.Player.Scp079Data.Level >= 4)
                                            {
                                                ev.Player.Scp079Data.MaxAP += 3;
                                            }
                                        }
                                        if (PluginManager.Manager.Server.GetPlayers()[posic].GetHealth() > 50)
                                        {
                                            PluginManager.Manager.Server.GetPlayers()[posic].AddHealth(-50);
                                        }
                                    }
                                    ev.Player.Scp079Data.Exp += 30;
                                    if (ev.Player.Scp079Data.Level >= 4)
                                    {
                                        ev.Player.Scp079Data.MaxAP += 10;
                                    }
                                }
                                if (Pasivaa[ev.Player.SteamId] == false)
                                {
                                    ev.ReturnMessage = "habilidad en cooldown";
                                }
                            }
                            if ((ev.Player.Scp079Data.Level < 4) && (ev.Player.Scp079Data.Level >= 2))
                            {
                                if (ev.Player.Scp079Data.AP < 50)
                                {
                                    ev.ReturnMessage = "Necesitas mas Energía (50)";
                                }

                                if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 50))
                                {
                                    ev.ReturnMessage = "Habilidad en cooldown";
                                }

                                if ((ev.Player.Scp079Data.AP >= 50) && (Pasivaa[ev.Player.SteamId] == true))
                                {
                                    ev.Player.Scp079Data.AP -= 50;
                                    ev.Player.SendConsoleMessage("Enviando nanobots al ataque.", "blue");
                                    ev.ReturnMessage           = "Enviando nanobots al ataque .";
                                    Pasivaa[ev.Player.SteamId] = false;
                                    int p = (int)System.Environment.OSVersion.Platform;
                                    if ((p == 4) || (p == 6) || (p == 128))
                                    {
                                        MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), MEC.Segment.FixedUpdate);
                                    }
                                    else
                                    {
                                        MEC.Timing.RunCoroutine(Cooldown0792(ev.Player), 1);
                                    }
                                    System.Random playrs = new System.Random();
                                    int           posic  = playrs.Next(0, PluginManager.Manager.Server.GetPlayers().Count);
                                    while ((PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.SPECTATOR) || (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Role == Role.SCP_079) || (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.NONE))
                                    {
                                        if (posic > PluginManager.Manager.Server.NumPlayers)
                                        {
                                            posic = 0;
                                        }
                                        posic = posic + 1;
                                    }
                                    if (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.SCP)
                                    {
                                        PluginManager.Manager.Server.GetPlayers()[posic].AddHealth(50);
                                    }

                                    if (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team != Smod2.API.Team.SCP)
                                    {
                                        if (PluginManager.Manager.Server.GetPlayers()[posic].GetHealth() <= 50)
                                        {
                                            PluginManager.Manager.Server.GetPlayers()[posic].Kill(DamageType.TESLA);
                                            ev.Player.Scp079Data.Exp += 30;
                                            if (ev.Player.Scp079Data.Level >= 4)
                                            {
                                                ev.Player.Scp079Data.MaxAP += 3;
                                            }
                                        }
                                        if (PluginManager.Manager.Server.GetPlayers()[posic].GetHealth() > 50)
                                        {
                                            PluginManager.Manager.Server.GetPlayers()[posic].AddHealth(-50);
                                        }
                                    }
                                    ev.Player.Scp079Data.Exp += 30;
                                    if (ev.Player.Scp079Data.Level >= 4)
                                    {
                                        ev.Player.Scp079Data.MaxAP += 10;
                                    }
                                }
                                if (Pasivaa[ev.Player.SteamId] == false)
                                {
                                    ev.ReturnMessage = "habilidad en cooldown";
                                }
                            }
                        }
                        /////////////////////////////////////////////////////////////////////////////////////////////////////////
                        if (ev.Player.Scp079Data.Level >= 4)
                        {
                            if (ev.Player.Scp079Data.AP < 50)
                            {
                                ev.ReturnMessage = "Necesitas mas Energía (50)";
                            }

                            if ((Pasivaa[ev.Player.SteamId] == false) && (ev.Player.Scp079Data.AP >= 50))
                            {
                                ev.ReturnMessage = "Habilidad en cooldown";
                            }

                            if ((ev.Player.Scp079Data.AP >= 50) && (Pasivaa[ev.Player.SteamId] == true))
                            {
                                ev.Player.Scp079Data.AP -= 50;
                                ev.Player.SendConsoleMessage("Enviando nanobots mejorados al ataque.", "red");
                                ev.ReturnMessage           = "Enviando nanobots mejorados al ataque .";
                                Pasivaa[ev.Player.SteamId] = false;



                                int p = (int)System.Environment.OSVersion.Platform;
                                if ((p == 4) || (p == 6) || (p == 128))
                                {
                                    MEC.Timing.RunCoroutine(Cooldown0793(ev.Player), MEC.Segment.FixedUpdate);
                                }
                                else
                                {
                                    MEC.Timing.RunCoroutine(Cooldown0793(ev.Player), 1);
                                }


                                System.Random playrs = new System.Random();
                                int           posic  = playrs.Next(0, PluginManager.Manager.Server.GetPlayers().Count);
                                while ((PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.SPECTATOR) || (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Role == Role.SCP_079) || (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.NONE))
                                {
                                    if (posic > PluginManager.Manager.Server.NumPlayers)
                                    {
                                        posic = 0;
                                    }
                                    posic = posic + 1;
                                }
                                if (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team == Smod2.API.Team.SCP)
                                {
                                    PluginManager.Manager.Server.GetPlayers()[posic].AddHealth(50);
                                }

                                if (PluginManager.Manager.Server.GetPlayers()[posic].TeamRole.Team != Smod2.API.Team.SCP)
                                {
                                    if (PluginManager.Manager.Server.GetPlayers()[posic].GetHealth() <= 75)
                                    {
                                        PluginManager.Manager.Server.GetPlayers()[posic].Kill(DamageType.TESLA);
                                        ev.Player.Scp079Data.Exp += 30;
                                        if (ev.Player.Scp079Data.Level >= 4)
                                        {
                                            ev.Player.Scp079Data.MaxAP += 3;
                                        }
                                    }
                                    if (PluginManager.Manager.Server.GetPlayers()[posic].GetHealth() > 75)
                                    {
                                        PluginManager.Manager.Server.GetPlayers()[posic].AddHealth(-75);
                                    }
                                }
                                ev.Player.Scp079Data.Exp += 30;
                                if (ev.Player.Scp079Data.Level >= 4)
                                {
                                    ev.Player.Scp079Data.MaxAP += 15;
                                }
                            }
                            if (Pasivaa[ev.Player.SteamId] == false)
                            {
                                ev.ReturnMessage = "habilidad en cooldown";
                            }
                        }
                    }
                }
            }
            else
            {
                ev.ReturnMessage = "nanobots desactivados";
            }
            if (ev.Command.StartsWith("nukenow"))
            {
                if (ev.Player.TeamRole.Role != Role.SCP_079)
                {
                    ev.ReturnMessage = "Tu no eres SCP-079, pero buen inteneto ;)";
                }
                if (ev.Player.TeamRole.Role == Role.SCP_079)
                {
                    if (ev.Player.Scp079Data.AP < 300)
                    {
                        ev.ReturnMessage = "Necesitas mas Energía (300)";
                    }
                    if (ev.Player.Scp079Data.AP >= 300)
                    {
                        ev.Player.Scp079Data.AP -= 300;
                        ev.Player.SendConsoleMessage("Lo importante es ganar... no?", "red");
                        ev.ReturnMessage = "..., Lo importante es ganar ....";
                        PluginManager.Manager.Server.Map.DetonateWarhead();
                    }
                }
            }
            if (ev.Player.TeamRole.Role == Role.TUTORIAL)
            {
                if (ev.Command.StartsWith("nanobotson"))
                {
                    antinanobots = false;
                }
                if (ev.Command.StartsWith("nanobotsoff"))
                {
                    antinanobots = true;
                }
            }
        }
コード例 #30
0
ファイル: EventHandler.cs プロジェクト: tkocher621/Watchlist
        // The event for when a player sends a console command.
        public void OnCallCommand(PlayerCallCommandEvent ev)
        {
            // Non case-sensitive
            string cmd = ev.Command.ToLower();

            // If a staff member wants to lookup a player in game they can do so as long as they have admin privileges
            if (cmd.StartsWith("lookup") && ((GameObject)ev.Player.GetGameObject()).GetComponent <ServerRoles>().RemoteAdmin)
            {
                string user = cmd.Replace("lookup", "").Trim();
                if (user.Length > 0)
                {
                    Player myPlayer = null;
                    if (int.TryParse(user, out int a))
                    {
                        myPlayer = GetPlayer(a);
                    }
                    else if (ulong.TryParse(user, out ulong b))
                    {
                        myPlayer = GetPlayer(b);
                    }
                    else
                    {
                        myPlayer = GetPlayer(user, out myPlayer);
                    }
                    if (myPlayer != null)
                    {
                        // If we entered a valid player, use a JSON library to parse the json file data and check for the target
                        JObject o = JObject.Parse(File.ReadAllText(Plugin.WatchlistFilePath));
                        if (o.ContainsKey(myPlayer.SteamId))
                        {
                            ev.ReturnMessage = $"Watchlist Player Lookup\n" +
                                               $"Player - {myPlayer.Name} ({myPlayer.SteamId})\n" +
                                               $"Discipline - {o[ev.Player.SteamId]["discipline"]}\n" +
                                               $"Reason - {o[ev.Player.SteamId]["reason"]}\n" +
                                               $"Staff Member - {o[ev.Player.SteamId]["staff"]}";
                        }
                        else
                        {
                            ev.ReturnMessage = $"Player '{myPlayer.Name}' not found in watchlist.";
                        }
                    }
                    else
                    {
                        ev.ReturnMessage = "Invalid player.";
                    }
                }
                else
                {
                    ev.ReturnMessage = "LOOKUP (NAME / STEAMID / PLAYERID)";
                }
            }
            // The report command
            else if (cmd.StartsWith("report"))
            {
                // Check if the player is banned before letting them send a report using the above method
                if (!isPlayerBanned(ev.Player))
                {
                    string msg = cmd.Replace("report", "").Trim();
                    if (msg.Length > 0)
                    {
                        // If we specified a valid player, it will send a packet to the server under the REPORT command with all the needed data
                        socket.Send(Encoding.UTF8.GetBytes($"REPORT{delim}{ev.Player.SteamId}{delim}{instance.Server.Port}{delim}{msg}"));
                        ev.ReturnMessage = "Report sent to the staff team.";
                    }
                    else
                    {
                        ev.ReturnMessage = "REPORT (MESSAGE)";
                    }
                }
                else
                {
                    ev.ReturnMessage = "You have been banned from using the report system.";
                }
            }
        }