public static void acceptinvite(ConsoleSystem.Arg arg)
    {
        BasePlayer basePlayer = arg.Player();

        if (basePlayer == null)
        {
            return;
        }
        if (basePlayer.currentTeam != 0)
        {
            return;
        }
        ulong num = arg.GetULong(0, (ulong)0);

        RelationshipManager.PlayerTeam playerTeam = RelationshipManager.Instance.FindTeam(num);
        if (playerTeam == null)
        {
            basePlayer.ClearPendingInvite();
            return;
        }
        if (Interface.CallHook("OnTeamAcceptInvite", playerTeam, basePlayer) != null)
        {
            return;
        }
        playerTeam.AcceptInvite(basePlayer);
    }
    public static void kickmember(ConsoleSystem.Arg arg)
    {
        BasePlayer basePlayer = arg.Player();

        if (basePlayer == null)
        {
            return;
        }
        RelationshipManager.PlayerTeam playerTeam = RelationshipManager.Instance.FindTeam(basePlayer.currentTeam);
        if (playerTeam == null)
        {
            return;
        }
        if (playerTeam.GetLeader() != basePlayer)
        {
            return;
        }
        ulong num = arg.GetULong(0, (ulong)0);

        if (basePlayer.userID == num)
        {
            return;
        }
        if (Interface.CallHook("OnTeamKick", playerTeam, basePlayer) != null)
        {
            return;
        }
        playerTeam.RemovePlayer(num);
    }
Пример #3
0
        void chatCmdBackpackGive(ConsoleSystem.Arg arg)
        {
            if (!arg.IsAdmin)
            {
                return;
            }

            var player = BasePlayer.FindByID(arg.GetULong(0));

            if (player == null)
            {
                PrintError("Игрок не был найден!");
                return;
            }

            Item item = ItemManager.CreateByPartialName("hoodie", 1);

            item.name = _config.displayName;
            item.skin = _config.skinIdBackpack;

            string trimmed = _config.displayName.Trim();
            var    name    = trimmed.Substring(0, trimmed.IndexOf('\n'));

            item.MoveToContainer(player.inventory.containerMain);
            player.SendConsoleCommand($"note.inv {item.info.itemid} 1 \"{name}\"");
            PrintWarning($"Выдали рюкзак игроку {player.displayName}");
        }
Пример #4
0
        private void SetMarkByIDCommand(ConsoleSystem.Arg arg)
        {
            ulong markID = arg.GetULong(0);

            BasePlayer mark = null;

            foreach (BasePlayer player in BasePlayer.allPlayerList)
            {
                if (player.userID == markID)
                {
                    mark = player;
                    break;
                }
            }

            if (mark != null)
            {
                ChangeMarkedPlayer(mark);
                ReloadInfoPanel();
                SendReply(arg, mark.displayName + " is now marked for death.");
            }
            else
            {
                Interface.Oxide.LogError($"Could not find player with SteamID {markID}");
                SendError(arg, $"Could not find player with SteamID {markID}");
            }
        }
Пример #5
0
        void cmdStatPlayer(ConsoleSystem.Arg arg)
        {
            if (arg.Connection != null && !arg.IsAdmin)
            {
                return;
            }

            var userId = arg.GetULong(0);

            if (!userId.IsSteamId())
            {
                SendReply(arg, "Invalid UserId");
            }

            var             mod = arg.GetInt(1);
            List <KillData> killdata;

            if (!kills.TryGetValue(userId, out killdata))
            {
                SendReply(arg, "User doesn't have kills");
                return;
            }

            switch (mod)
            {
            case 0:
                killdata = killdata.OrderByDescending(p => p.Time).ToList();
                break;

            case 1:
                killdata = killdata.OrderByDescending(p => p.Distance).ToList();
                break;

            case 2:
                killdata = killdata.OrderBy(p => p.Weapon).ToList();
                break;
            }
            var viewData = killdata.Where(p => float.Parse(p.Distance) >= 10).ToList();
            var msg      = new StringBuilder("\n");

            msg.Append($"Максимальная дистанция: {viewData.Max(p => float.Parse(p.Distance))}\n");
            var bones = new Dictionary <string, int>();

            foreach (var k in viewData.Select(p => p.Bone).ToList())
            {
                if (!bones.ContainsKey(k))
                {
                    bones.Add(k, viewData.Count(p => p.Bone == k));
                }
            }
            msg.Append($"Любимая часть тела: {bones.OrderByDescending(p=>p.Value).ToList()[0].Key}\n");
            msg.Append(ConsoleTable.From(viewData).ToMarkDownString());
            Puts(msg.ToString());
        }
    public static void fakeinvite(ConsoleSystem.Arg arg)
    {
        BasePlayer player = arg.Player();

        RelationshipManager.PlayerTeam team = RelationshipManager.Instance.FindTeam(arg.GetULong(0, 0UL));
        if (team == null)
        {
            return;
        }
        if (player.currentTeam != 0UL)
        {
            Debug.Log((object)"already in team");
        }
        team.SendInvite(player);
        Debug.Log((object)"sent bot invite");
    }
    public static void fakeinvite(ConsoleSystem.Arg arg)
    {
        BasePlayer basePlayer = arg.Player();
        ulong      num        = arg.GetULong(0, (ulong)0);

        RelationshipManager.PlayerTeam playerTeam = RelationshipManager.Instance.FindTeam(num);
        if (playerTeam == null)
        {
            return;
        }
        if (basePlayer.currentTeam != 0)
        {
            Debug.Log("already in team");
        }
        playerTeam.SendInvite(basePlayer);
        Debug.Log("sent bot invite");
    }
    public static void kickmember(ConsoleSystem.Arg arg)
    {
        BasePlayer basePlayer = arg.Player();

        if (Object.op_Equality((Object)basePlayer, (Object)null))
        {
            return;
        }
        RelationshipManager.PlayerTeam team = RelationshipManager.Instance.FindTeam(basePlayer.currentTeam);
        if (team == null || Object.op_Inequality((Object)team.GetLeader(), (Object)basePlayer))
        {
            return;
        }
        ulong playerID = arg.GetULong(0, 0UL);

        if ((long)basePlayer.userID == (long)playerID || Interface.CallHook("OnTeamKick", (object)team, (object)basePlayer) != null)
        {
            return;
        }
        team.RemovePlayer(playerID);
    }
    public static void rejectinvite(ConsoleSystem.Arg arg)
    {
        BasePlayer player = arg.Player();

        if (Object.op_Equality((Object)player, (Object)null) || player.currentTeam != 0UL)
        {
            return;
        }
        RelationshipManager.PlayerTeam team = RelationshipManager.Instance.FindTeam(arg.GetULong(0, 0UL));
        if (team == null)
        {
            player.ClearPendingInvite();
        }
        else
        {
            if (Interface.CallHook("OnTeamRejectInvite", (object)player, (object)team) != null)
            {
                return;
            }
            team.RejectInvite(player);
        }
    }
Пример #10
0
        void OnServerCommand(ConsoleSystem.Arg arg)
        {
            if (!Discord || arg.Connection == null || !arg.HasArgs(2))
            {
                return;
            }

            if (arg.cmd.FullName == "server.cheatreport")
            {
                ulong      steamId      = arg.GetULong(0);
                string     text         = arg.GetString(1);
                BasePlayer reporter     = arg.Player();
                BasePlayer reportTarget = BasePlayer.Find(steamId.ToString());

                if (reportTarget == null || string.IsNullOrEmpty(text))
                {
                    return;
                }

                string message = $"Reporter: {reporter.displayName} [{reporter.UserIDString}]\n Reported: {reportTarget.displayName} [{reportTarget.userID}].\nReason: {text}";

                Discord.Call("SendMessage", message);
            }
        }