当前位置: 首页>>代码示例>>C#>>正文


C# NetUser.Kick方法代码示例

本文整理汇总了C#中NetUser.Kick方法的典型用法代码示例。如果您正苦于以下问题:C# NetUser.Kick方法的具体用法?C# NetUser.Kick怎么用?C# NetUser.Kick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetUser的用法示例。


在下文中一共展示了NetUser.Kick方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: uLink_OnPlayerConnected

        public void uLink_OnPlayerConnected(uLink.NetworkPlayer player)
        {
            connectingPlayer = (NetUser)player.localData;
            String playerSteamURL = "http://steamcommunity.com/profiles/" + connectingPlayer.userID.ToString();

            WebClient wc = new WebClient ();
            wc.DownloadStringCompleted += (sender, e) =>
            {
                userProfilePage = e.Result;

                if (lockGroup != "none")
                {
                    if (userProfilePage.IndexOf("http://steamcommunity.com/groups/" + lockGroup) == -1)
                    {
                        connectingPlayer.Kick(NetError.Facepunch_Kick_Ban, true);
                    }
                }

                Match vacMatch = Regex.Match(userProfilePage, @"^([0-9]{1,5}) day\(s\) since last ban$");
                if (vacMatch.Success)
                {
                    int daysSinceBan = Convert.ToInt32(vacMatch.Groups[1].Value);
                    if (daysSinceBan < minVacDays)
                    {
                        connectingPlayer.Kick(NetError.Facepunch_Kick_Ban, true);
                    }
                }
            };

            wc.DownloadStringAsync(new Uri(playerSteamURL));
        }
开发者ID:BARKx4,项目名称:GroupGate,代码行数:31,代码来源:GroupGateBootstrap.cs

示例2: IOnGetClientMove

 private object IOnGetClientMove(NetUser netUser, Vector3 pos)
 {
     if (float.IsNaN(pos.x) || float.IsInfinity(pos.x) || float.IsNaN(pos.y) || float.IsInfinity(pos.y) || float.IsNaN(pos.z) || float.IsInfinity(pos.z))
     {
         Interface.Oxide.LogInfo($"Banned {netUser.displayName} [{netUser.userID}] for sending bad packets (possible teleport hack)");
         BanList.Add(netUser.userID, netUser.displayName, "Sending bad packets (possible teleport hack)");
         netUser.Kick(NetError.ConnectionBanned, true);
         return false;
     }
     return null;
 }
开发者ID:906507516,项目名称:Oxide,代码行数:11,代码来源:RustLegacyCore.cs

示例3: otherKick

 public static void otherKick(NetUser target, string reason)
 {
     if (target != null)
     {
         kickQueue.Add(target.userID.ToString());
         Broadcast.broadcastTo(target.networkPlayer, "You were kicked! Reason: " + reason);
         Vars.conLog.Error("Player " + target.displayName + " (" + target.userID + ") was kicked for: " + reason);
         target.Kick(NetError.Facepunch_Kick_Ban, false);
     }
 }
开发者ID:TheOneAndOnlyLoki,项目名称:RustEssentials,代码行数:10,代码来源:Vars.cs

示例4: kickPlayer

 public static void kickPlayer(NetUser target, string reason, bool isBan)
 {
     if (target != null)
     {
         kickQueue.Add(target.userID.ToString());
         Broadcast.broadcastTo(target.networkPlayer, (isBan ? "You were banned! Reason: " : "You were kicked! Reason: ") + reason);
         if (isBan)
             Vars.conLog.Error("Banned player " + target.displayName + " (" + target.userID + ") attempted to join.");
         target.Kick(NetError.Facepunch_Kick_Ban, false);
         if (!isBan)
         {
             Broadcast.broadcastAll("Player " + target.displayName + " was kicked. Reason: " + reason);
             Vars.conLog.Error("Player " + target.displayName + " (" + target.userID + ") was kicked for: " + reason);
         }
     }
 }
开发者ID:TheOneAndOnlyLoki,项目名称:RustEssentials,代码行数:16,代码来源:Vars.cs

示例5: whitelistKick

 public static void whitelistKick(NetUser target, string reason)
 {
     if (target != null)
     {
         kickQueue.Add(target.userID.ToString());
         Broadcast.broadcastTo(target.networkPlayer, "You were kicked! Reason: " + reason);
         Vars.conLog.Error("Nonwhitelisted player " + target.displayName + " (" + target.userID + ") attempted to join.");
         target.Kick(NetError.Facepunch_Kick_Ban, false);
     }
 }
开发者ID:TheOneAndOnlyLoki,项目名称:RustEssentials,代码行数:10,代码来源:Vars.cs

示例6: KickUser

 public static void KickUser(NetUser player, NetError reason, bool notify)
 {
     // reson = NetError.Facepunch_Kick_Violation
     player.Kick(reason, notify);
     //player.playerClient.netUser.Kick(reason, notify);
 }
开发者ID:Riketta,项目名称:rust-anticheat,代码行数:6,代码来源:RustAPI.cs

示例7: loginNotice

 public static bool loginNotice(NetUser user)
 {
     try
     {
         if (Core.blackList.Contains(user.userID))
         {
             Core.tempConnect.Add(user.userID);
             user.Kick(NetError.Facepunch_Connector_VAC_Banned, true);
             return false;
         }
         if (((Core.config.GetSetting("WhiteList", "enabled") != null) && (Core.config.GetSetting("WhiteList", "enabled").ToLower() == "true")) && !Core.whiteList.Contains(user.userID))
         {
             user.Kick(NetError.Facepunch_Connector_AuthFailure, true);
         }
         if (!Core.userCache.ContainsKey(user.userID))
         {
             Core.userCache.Add(user.userID, user.displayName);
         }
         else if (user.displayName != Core.userCache[user.userID])
         {
             Core.userCache[user.userID] = user.displayName;
         }
         if (Administrator.IsAdmin(user.userID) && Administrator.GetAdmin(user.userID).HasPermission("RCON"))
         {
             user.admin = true;
         }
         Core.motd(user.networkPlayer);
         if (Core.config.GetSetting("Settings", "join_notice").ToLower() == "true")
         {
             foreach (PlayerClient client in PlayerClient.All)
             {
                 if (client.userID != user.userID)
                 {
                     Util.sayUser(client.netPlayer, Core.Name, user.displayName + " has joined the server");
                 }
             }
         }
     }
     catch
     {
     }
     return true;
 }
开发者ID:balu92,项目名称:Fougerite,代码行数:43,代码来源:Hooks.cs


注:本文中的NetUser.Kick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。