コード例 #1
0
ファイル: ModeratorTools.cs プロジェクト: rustmy/rustylife
        void cmdChatBan(BasePlayer player, string command, string[] args)
        {
            if (!PermissionService.HasPermission(player.userID, BAN_PERM))
            {
                SendReply(player, "Недостаточно прав!");
                return;
            }
            if (args.Length < 2)
            {
                return;
            }
            var    nameOrId = args[0];
            string reason   = args[1];

            var uid  = nameOrId.IsSteamId() ? ulong.Parse(nameOrId) : core.FindUid(nameOrId);
            var name = core.FindDisplayname(uid);


            if (args.Length == 3)
            {
                var secs = core.StringToTime(args[2]);
                bans[uid] = Now().AddSeconds(secs).ToString(TIME_FORMAT);
            }
            else
            {
                bans[uid] = Now().AddSeconds(3000000000).ToString(TIME_FORMAT);
            }
            BasePlayer.activePlayerList.FirstOrDefault(p => p.userID == uid)?.Kick(reason);
            rust.BroadcastChat("<color=red>Rusty Life</color>",
                               string.Format(Messages["banPermanent"], $"{uid}/{name}", reason));
        }
コード例 #2
0
ファイル: RustyChat.cs プロジェクト: rustmy/rustylife
        void cmdChatMuteList(BasePlayer player, string command, string[] args)
        {
            if (!PermissionService.HasPermission(player.userID, PERM_MUTE))
            {
                Reply(player, "У вас нет доступа к этой команде!");
                return;
            }
            var msg = new StringBuilder();

            foreach (var mute in mutes)
            {
                var name = core.FindDisplayname(mute.Key);
                msg.Append($"{name} на {mute.Value}\n");
            }
        }