Пример #1
0
        /// <summary>
        /// Deletes the server from the database, and stop the NetServer
        /// </summary>
        public static void ServerStop()
        {
            //Disconnects local Client
            Client.ClientStop();
            //Sends message to clients that the server is closing
            var outMsg = _server.CreateMessage();

            outMsg.Write((byte)PacketTypes.Closed);
            _server.SendToAll(outMsg, NetDeliveryMethod.ReliableOrdered);
            //Shuts down server and deletes it from the database
            _shouldStop = true;
            _server.Shutdown("Closed");
            NetworkClasses.DeleteServer(User.PlayerId);
            NetworkClasses.UpdateUserValue("User_List", "_Character", null, User.PlayerId);
        }