protected override void OnClientKick(ref MyControlKickClientMsg data, ulong sender)
 {
     if (MySession.Static.IsUserAdmin(sender))
     {
         KickClient(data.KickedClient);
     }
 }
Esempio n. 2
0
        public override void KickClient(ulong client)
        {
            MyControlKickClientMsg msg = new MyControlKickClientMsg();

            msg.KickedClient = client;
            SendControlMessage(ServerId, ref msg);
        }
 protected override void OnClientKick(ref MyControlKickClientMsg data, ulong sender)
 {
     if (IsAdmin(sender))
     {
         KickClient(data.KickedClient);
     }
 }
Esempio n. 4
0
        public override void KickClient(ulong userId, bool kicked = true, bool add = true)
        {
            MyControlKickClientMsg msg2;

            if (!kicked)
            {
                msg2 = new MyControlKickClientMsg {
                    KickedClient = userId,
                    Kicked       = kicked
                };
                MyControlKickClientMsg message = msg2;
                MyLog.Default.WriteLineAndConsole("Player " + userId + " unkicked");
                base.RemoveKickedClient(userId);
                base.SendControlMessageToAll <MyControlKickClientMsg>(ref message, 0UL);
            }
            else
            {
                msg2 = new MyControlKickClientMsg {
                    KickedClient = userId,
                    Kicked       = kicked,
                    Add          = add
                };
                MyControlKickClientMsg message = msg2;
                MyLog.Default.WriteLineAndConsole("Player " + this.GetMemberName(userId) + " kicked");
                base.SendControlMessageToAll <MyControlKickClientMsg>(ref message, 0UL);
                if (add)
                {
                    base.AddKickedClient(userId);
                }
                base.RaiseClientLeft(userId, MyChatMemberStateChangeEnum.Kicked);
            }
        }
Esempio n. 5
0
 protected override void OnClientKick(ref MyControlKickClientMsg data, ulong sender)
 {
     if (!data.Kicked)
     {
         base.RemoveKickedClient(data.KickedClient);
     }
     else if (data.KickedClient != Sync.MyId)
     {
         if (data.Add)
         {
             base.AddKickedClient(data.KickedClient);
         }
         base.RaiseClientLeft(data.KickedClient, MyChatMemberStateChangeEnum.Kicked);
     }
     else
     {
         MySessionLoader.UnloadAndExitToMenu();
         StringBuilder messageCaption = MyTexts.Get(MyCommonTexts.MessageBoxCaptionKicked);
         MyStringId?   okButtonText   = null;
         okButtonText = null;
         okButtonText = null;
         okButtonText = null;
         Vector2?size = null;
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.OK, MyTexts.Get(MyCommonTexts.MessageBoxTextYouHaveBeenKicked), messageCaption, okButtonText, okButtonText, okButtonText, okButtonText, null, 0, MyGuiScreenMessageBox.ResultEnum.YES, true, size));
     }
 }
Esempio n. 6
0
        public override void KickClient(ulong client, bool kicked = true, bool add = true)
        {
            MyControlKickClientMsg message = new MyControlKickClientMsg {
                KickedClient = client,
                Kicked       = kicked
            };

            base.SendControlMessage <MyControlKickClientMsg>(base.ServerId, ref message, true);
        }
        public override void KickClient(ulong userId)
        {
            MyControlKickClientMsg msg = new MyControlKickClientMsg();

            msg.KickedClient = userId;

            MyLog.Default.WriteLineAndConsole("Player " + GetMemberName(userId) + " kicked");
            SendControlMessageToAll(ref msg);

            AddKickedClient(userId);
            RaiseClientLeft(userId, ChatMemberStateChangeEnum.Kicked);
        }
Esempio n. 8
0
 protected override void OnClientKick(ref MyControlKickClientMsg data, ulong kicked)
 {
     if (data.KickedClient == MySteam.UserId)
     {
         MyGuiScreenMainMenu.ReturnToMainMenu();
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                    messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionKicked),
                                    messageText: MyTexts.Get(MySpaceTexts.MessageBoxTextYouHaveBeenKicked)));
     }
     else
     {
         AddKickedClient(data.KickedClient);
         RaiseClientLeft(data.KickedClient, ChatMemberStateChangeEnum.Kicked);
     }
 }
Esempio n. 9
0
        protected override void OnClientKick(ref MyControlKickClientMsg data, ulong kicked)
        {
            RaiseClientKicked(data.KickedClient);

            if (data.KickedClient == Sync.MyId)
            {
                MySessionLoader.UnloadAndExitToMenu();
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionKicked),
                                           messageText: MyTexts.Get(MyCommonTexts.MessageBoxTextYouHaveBeenKicked)));
            }
            else
            {
                AddKickedClient(data.KickedClient);
                RaiseClientLeft(data.KickedClient, ChatMemberStateChangeEnum.Kicked);
            }
        }
Esempio n. 10
0
        public override void KickClient(ulong userId)
        {
            // In standard MP games, only the game server can kick players
            var myId = SteamAPI.Instance.GetSteamUserId();

            if (userId == myId || Lobby.GetOwner() != myId)
            {
                return;
            }

            MyControlKickClientMsg msg = new MyControlKickClientMsg();

            msg.KickedClient = userId;
            MyLog.Default.WriteLineAndConsole("Player " + GetMemberName(userId) + " kicked");
            SendControlMessageToAll(ref msg);

            RaiseClientLeft(userId, ChatMemberStateChangeEnum.Kicked);
        }
Esempio n. 11
0
        protected override void OnClientKick(ref MyControlKickClientMsg data, ulong sender)
        {
            if (data.KickedClient == Sync.MyId)
            {
                // We don't want to send disconnect message because the clients will disconnect the client automatically upon receiving on the MyControlKickClientMsg
                m_clientJoined = false;

                Dispose();
                MyGuiScreenMainMenu.ReturnToMainMenu();
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionKicked),
                                           messageText: MyTexts.Get(MyCommonTexts.MessageBoxTextYouHaveBeenKicked)));
            }
            else
            {
                AddKickedClient(data.KickedClient);
                RaiseClientLeft(data.KickedClient, ChatMemberStateChangeEnum.Kicked);
            }
        }
Esempio n. 12
0
 private void MyMultiplayerLobby_ClientLeft(ulong userId, MyChatMemberStateChangeEnum stateChange)
 {
     if (userId == base.ServerId)
     {
         MyGameService.Peer2Peer.CloseSession(userId);
     }
     if ((stateChange == MyChatMemberStateChangeEnum.Kicked) || (stateChange == MyChatMemberStateChangeEnum.Banned))
     {
         MyControlKickClientMsg message = new MyControlKickClientMsg {
             KickedClient = userId,
             Kicked       = true,
             Add          = false
         };
         MyLog.Default.WriteLineAndConsole("Player " + this.GetMemberName(userId) + " kicked");
         base.SendControlMessageToAll <MyControlKickClientMsg>(ref message, 0UL);
     }
     object[] objArray1 = new object[] { "Player left: ", this.GetMemberName(userId), " (", userId, ")" };
     MySandboxGame.Log.WriteLineAndConsole(string.Concat(objArray1));
 }
Esempio n. 13
0
 protected abstract void OnClientKick(ref MyControlKickClientMsg data, ulong sender);