예제 #1
0
        public override void Execute(PointBlankPlayer executor, string[] args)
        {
            CommandWindow.Log(Translations["Debug_Title"]);
            CommandWindow.Log(string.Format(Translations["Debug_SteamID"], SteamGameServer.GetSteamID()));
            CommandWindow.Log(string.Format(Translations["Debug_IP"], Parser.getIPFromUInt32(SteamGameServer.GetPublicIP())));
            CommandWindow.Log(string.Format(Translations["Debug_Port"], Provider.port));

            CommandWindow.Log(string.Format(Translations["Debug_BytesSent"], Provider.bytesSent));
            CommandWindow.Log(string.Format(Translations["Debug_BytesReceived"], Provider.bytesReceived));

            CommandWindow.Log(string.Format(Translations["Debug_ABytesSent"], (uint)(Provider.bytesSent / Time.realtimeSinceStartup)));
            CommandWindow.Log(string.Format(Translations["Debug_ABytesReceived"], (uint)(Provider.bytesReceived / Time.realtimeSinceStartup)));

            CommandWindow.Log(string.Format(Translations["Debug_PacketsSent"], Provider.packetsSent));
            CommandWindow.Log(string.Format(Translations["Debug_PacketsReceived"], Provider.packetsReceived));

            CommandWindow.Log(string.Format(Translations["Debug_APacketsSent"], (uint)(Provider.packetsSent / Time.realtimeSinceStartup)));
            CommandWindow.Log(string.Format(Translations["Debug_APacketsReceived"], (uint)(Provider.packetsReceived / Time.realtimeSinceStartup)));

            CommandWindow.Log(string.Format(Translations["Debug_UPS"], Mathf.CeilToInt(Provider.debugUPS / 50f * 100f)));
            CommandWindow.Log(string.Format(Translations["Debug_TPS"], Mathf.CeilToInt((Provider.debugTPS / 50f * 100f))));

            CommandWindow.Log(string.Format(Translations["Debug_Zombies"], ZombieManager.tickingZombies.Count));
            CommandWindow.Log(string.Format(Translations["Debug_Animals"], AnimalManager.tickingAnimals.Count));
        }
예제 #2
0
        public Tetrominous_Server()
        {
            if (!SteamGameServer.InitGameServer(0, TETROMINOUS_SERVER_PORT, TETROMINOUS_MASTER_SERVER_UPDATER_PORT, 0, Game1.APPID, TETROMINOUS_SERVER_VERSION))
            {
                Console.WriteLine("Failed to Initiate Game Server.");
            }

            // Set the "game dir".
            // This is currently required for all games.  However, soon we will be
            // using the AppID for most purposes, and this string will only be needed
            // for mods.  it may not be changed after the server has logged on
            SteamGameServer.SetModDir(GAMEDIR);

            // These fields are currently required, but will go away soon.
            // See their documentation for more info
            SteamGameServer.SetProduct("Tetronimous");
            SteamGameServer.SetGameDescription("Tetris minigames");

            // Initiate Anonymous login
            SteamGameServer.LogOnAnonymous();

            // We want to actively update the master server with our presence so players can
            // find us via the steam matchmaking/server browser interfaces
            SteamGameServer.EnableHeartbeats(true);
        }
예제 #3
0
        private void OnServerInitialized()
        {
            if (serverInitialized)
            {
                return;
            }
            serverInitialized = true;

            Analytics.Collect();

            // Add some Steam tags
            SteamGameServer.SetGameTags("oxide,modded");

            // Update server console window and status bars
            TheForestExtension.ServerConsole();

            // Save the level every X minutes
            Interface.Oxide.GetLibrary <Timer>().Repeat(300f, 0, () =>
            {
                LevelSerializer.SaveGame("Game"); // TODO: Make optional
                LevelSerializer.Checkpoint();
                Interface.Oxide.LogInfo("Server has been saved!");
            });

            // Check if client should be disabled
            //if (commandLine.HasVariable("batchmode") || commandLine.HasVariable("nographics"))
            //{
            TheForestExtension.DisableAudio();
            TheForestExtension.DisableClient();
            //}
        }
예제 #4
0
        private void UpdateSteamGameServerValues()
        {
            if (Configuration.Instance.largeServer)
            {
                if (Provider.maxPlayers > 24)
                {
                    SteamGameServer.SetMaxPlayerCount(24);
                }
                else
                {
                    Logger.Log("Skipping large server due to server count being below 24 players");
                }
            }

            if (Configuration.Instance.gameName != null)
            {
                SteamGameServer.SetGameTags((!Provider.isPvP ? "PVE" : "PVP") + ",GAMEMODE:" + Configuration.Instance.gameName + ',' + (!Provider.hasCheats ? "STAEHC" : "CHEATS") + ',' + Provider.mode.ToString() + "," + Provider.cameraMode.ToString() + "," + (Provider.serverWorkshopFileIDs.Count <= 0 ? "KROW" : "WORK") + "," + (!Provider.isGold ? "YLNODLOG" : "GOLDONLY") + "," + (!Provider.configData.Server.BattlEye_Secure ? "BATTLEYE_OFF" : "BATTLEYE_ON"));
            }

            if (Configuration.Instance.hideWorkshop)
            {
                SteamGameServer.SetKeyValue("Browser_Workshop_Count", null);
            }

            if (Configuration.Instance.hideConfiguration)
            {
                SteamGameServer.SetKeyValue("Browser_Config_Count", null);
            }

            if (Configuration.Instance.rocketPlugins != null)
            {
                SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", Configuration.Instance.rocketPlugins.ToArray()));
            }
        }
    //-----------------------------------------------------------------------------
    // Purpose: Called once we are connected to Steam to tell it about our details
    //-----------------------------------------------------------------------------
    void SendUpdatedServerDetailsToSteam()
    {
        //
        // Set state variables, relevant to any master server updates or client pings
        //

        // These server state variables may be changed at any time.  Note that there is no lnoger a mechanism
        // to send the player count.  The player count is maintained by steam and you should use the player
        // creation/authentication functions to maintain your player count.
        SteamGameServer.SetMaxPlayerCount(m_nMaxPlayers);
        SteamGameServer.SetPasswordProtected(false);
        SteamGameServer.SetServerName(m_strServerName);
        SteamGameServer.SetBotPlayerCount(0);         // optional, defaults to zero
        SteamGameServer.SetMapName(m_strMapName);

#if USE_GS_AUTH_API
        // Update all the players names/scores

        /* @TODO: Riley: Disabled
         * for (uint32 i = 0; i < MAX_PLAYERS_PER_SERVER; ++i) {
         *      if (m_rgClientData[i].m_bActive && m_rgpShips[i]) {
         *              SteamGameServer.BUpdateUserData(m_rgClientData[i].m_SteamIDUser, m_rgpShips[i]->GetPlayerName(), m_rguPlayerScores[i]);
         *      }
         * }*/
#endif

        // game type is a special string you can use for your game to differentiate different game play types occurring on the same maps
        // When users search for this parameter they do a sub-string search of this string
        // (i.e if you report "abc" and a client requests "ab" they return your server)
        //SteamGameServer.SetGameType( "dm" );

        // update any rule values we publish
        //SteamGameServer.SetKeyValue( "rule1_setting", "value" );
        //SteamGameServer.SetKeyValue( "rule2_setting", "value2" );
    }
예제 #6
0
        private void OnServerInitialized()
        {
            if (serverInitialized)
            {
                return;
            }
            serverInitialized = true;

            // Configure the hostname after it has been set
            RemoteLogger.SetTag("hostname", PlayerPrefs.GetString("MpGameName"));

            // Add 'oxide' and 'modded' tags
            SteamGameServer.SetGameTags("oxide,modded");

            // Update server console window and status bars
            TheForestExtension.ServerConsole();

            // Disable audio and client-side elements if not dedicated
            if (TheForestExtension.DisableClient)
            {
                DisableAudio();
                DisableClient();
            }

            // Save the level every X minutes
            Interface.Oxide.GetLibrary <Timer>().Once(300f, () => LevelSerializer.SaveGame("Game"));
        }
예제 #7
0
        public override void Open(string bindip, ushort port, bool lan)
        {
            if (bindip == "*")
            {
                bindip = "0.0.0.0";
            }
            if (IsHosting)
            {
                return;
            }
            var         ip   = SteamworksCommon.GetUInt32FromIp(bindip);
            EServerMode mode = EServerMode.eServerModeAuthenticationAndSecure;

            //if(lan) mode = EServerMode.eServerModeNoAuthentication;
            if (!GameServer.Init(ip, (ushort)(port + 2), port, (ushort)(port + 1), mode,
                                 GameInfo.VERSION))
            {
                throw new ServerInitializationFailedException("Couldn't start server (Steamworks API initialization failed)");
            }

            SteamGameServer.SetDedicatedServer(!lan);
            SteamGameServer.SetGameDescription(GameInfo.NAME);
            SteamGameServer.SetProduct(GameInfo.NAME);
            SteamGameServer.SetModDir(GameInfo.NAME);
            SteamGameServer.SetServerName(Description);
            SteamGameServer.LogOnAnonymous();
            SteamGameServer.SetPasswordProtected(false); //Todo
            SteamGameServer.EnableHeartbeats(true);

            Application.targetFrameRate = 60;
            IsHosting = true;
        }
예제 #8
0
        private void OnServerInitialized()
        {
            if (serverInitialized)
            {
                return;
            }
            serverInitialized = true;

            // Configure remote logging
            RemoteLogger.SetTag("hostname", PlayerPrefs.GetString("MpGameName"));

            // Add some Steam tags
            SteamGameServer.SetGameTags("oxide,modded");

            // Update server console window and status bars
            TheForestExtension.ServerConsole();

            // Save the level every X minutes
            Interface.Oxide.GetLibrary <Timer>().Repeat(300f, 0, () =>
            {
                LevelSerializer.SaveGame("Game"); // TODO: Make optional
                LevelSerializer.Checkpoint();
                Interface.Oxide.LogInfo("Server has been saved!");
            });
        }
예제 #9
0
 private void ClampMaxPlayers()
 {
     if (Provider.maxPlayers > 24)
     {
         SteamGameServer.SetMaxPlayerCount(24);
     }
 }
예제 #10
0
        private void onChat(SteamPlayer player, EChatMode mode, ref Color chatted, ref bool isRich, string text, ref bool isVisible)
        {
            var converted = UnturnedPlayer.FromSteamPlayer(player);

            var webhook = Configuration.Instance.DiscordWebHookLink;

            var lower = text.ToLower();

            var ip = SteamGameServer.GetPublicIP();

            var address = ip.ToString();

            if (Configuration.Instance.LogCommands.Any(w => lower.StartsWith($"/{w.name} ")))
            {
                if (webhook == "Discord Webhook Here")
                {
                    return;
                }
                sendDiscordWebhook(webhook, ("{  \"username\": \"Command Log\",  \"avatar_url\": \"https://i.imgur.com/4M34hi2.png\",  \"embeds\": [    {      \"title\": \"Command Executed\",      \"color\": 15258703,      \"fields\": [        {          \"name\": \"Executer - !executer!\",          \"value\": \"ExecuterID\",          \"inline\": true        },        {          \"name\": \"Command:\",          \"value\": \"*!args!*\"        },        {          \"name\": \"Server IP\",          \"value\": \"!ip!\"        }      ],      \"thumbnail\": {        \"url\": \"https://i.pinimg.com/originals/1b/e8/41/1be84116e72d71bd6785c7050fefd2e3.gif\"      },      \"image\": {        \"url\": \"https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg\"      },      \"footer\": {        \"text\": \"CommandLog by ExoPlugins\",        \"icon_url\": \"https://media.discordapp.net/attachments/811275497966665739/823878043906080778/image0.png?width=128&height=128\"      }    }  ]}").Replace("!executer!", converted.DisplayName).Replace("*!args!*", $"`{lower}`").Replace("!ip!", address).Replace("ExecuterID", converted.Id));
            }

            else if (Configuration.Instance.LogCommands.Any(w => lower.StartsWith($"/{w.name}")))
            {
                if (webhook == "Discord Webhook Here")
                {
                    return;
                }
                sendDiscordWebhook(webhook, ("{  \"username\": \"Command Log\",  \"avatar_url\": \"https://i.imgur.com/4M34hi2.png\",  \"embeds\": [    {      \"title\": \"Command Executed\",      \"color\": 15258703,      \"fields\": [        {          \"name\": \"Executer - !executer!\",          \"value\": \"ExecuterID\",          \"inline\": true        },        {          \"name\": \"Command:\",          \"value\": \"*!args!*\"        },        {          \"name\": \"Server IP\",          \"value\": \"!ip!\"        }      ],      \"thumbnail\": {        \"url\": \"https://i.pinimg.com/originals/1b/e8/41/1be84116e72d71bd6785c7050fefd2e3.gif\"      },      \"image\": {        \"url\": \"https://upload.wikimedia.org/wikipedia/commons/5/5a/A_picture_from_China_every_day_108.jpg\"      },      \"footer\": {        \"text\": \"CommandLog by ExoPlugins\",        \"icon_url\": \"https://media.discordapp.net/attachments/811275497966665739/823878043906080778/image0.png?width=128&height=128\"      }    }  ]}").Replace("!executer!", converted.DisplayName).Replace("*!args!*", $"`{lower}`").Replace("!ip!", address).Replace("ExecuterID", converted.Id));
            }
        }
예제 #11
0
 public void Shutdown()
 {
     SteamGameServer.EnableHeartbeats(false);
     SteamGameServer.LogOff();
     GameServer.Shutdown();
     Debug.Log("Shutdown.");
 }
예제 #12
0
 private void OnDisable()
 {
     SteamGameServer.EnableHeartbeats(false);
     SteamGameServer.LogOff();
     GameServer.Shutdown();
     Debug.Log("Shutdown.");
 }
예제 #13
0
    private void Launch()
    {
        CoopSteamManager.Initialize();
        CoopPeerStarter.Dedicated     = true;
        CoopPeerStarter.DedicatedHost = true;
        CoopLobby.SetActive(new CoopLobbyInfo(SteamGameServer.GetSteamID())
        {
            Name        = SteamDSConfig.ServerName,
            Joinable    = true,
            MemberLimit = SteamDSConfig.ServerPlayers
        });
        if (GameSetup.IsSavedGame)
        {
            SaveSlotUtils.LoadHostGameGUID();
        }
        if (string.IsNullOrEmpty(CoopLobby.Instance.Info.Guid) || GameSetup.IsNewGame)
        {
            CoopLobby.Instance.SetGuid(Guid.NewGuid().ToString());
        }
        SteamDSConfig.ServerGUID = CoopLobby.Instance.Info.Guid;
        GameSetup.SetMpType(MpTypes.Server);
        GameSetup.SetPlayerMode(PlayerModes.Multiplayer);
        FMOD_StudioSystem.ForceFmodOff = true;
        GameObject             gameObject             = new GameObject("CoopSteamServerStarter");
        CoopSteamServerStarter coopSteamServerStarter = gameObject.AddComponent <CoopSteamServerStarter>();

        coopSteamServerStarter.mapState = CoopPeerStarter.MapState.None;
        coopSteamServerStarter._async   = this.loadAsync;
        UnityEngine.Object.DontDestroyOnLoad(gameObject);
    }
    private void OnDisable()
    {
        if (!m_bInitialized)
        {
            return;
        }


        // Notify Steam master server we are going offline
#if USE_GS_AUTH_API
        SteamGameServer.EnableHeartbeats(false);
#endif

        m_CallbackSteamServersConnected.Dispose();
        // Disconnect from the steam servers
        SteamGameServer.LogOff();



        // release our reference to the steam client library
        GameServer.Shutdown();
        m_bInitialized = false;

        Debug.Log("Shutdown.");
    }
예제 #15
0
        internal void Initialize()
        {
            try
            {
                Settings    = new XMLFileAsset <UnturnedSettings>(Environment.SettingsFile);
                Translation = new XMLFileAsset <TranslationList>(String.Format(Environment.TranslationFile, Core.R.Settings.Instance.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations);
                defaultTranslations.AddUnknownEntries(Translation);
                Events = gameObject.TryAddComponent <UnturnedEvents>();

                gameObject.TryAddComponent <UnturnedPermissions>();
                gameObject.TryAddComponent <UnturnedChat>();
                gameObject.TryAddComponent <UnturnedCommands>();

                gameObject.TryAddComponent <AutomaticSaveWatchdog>();

                bindDelegates();

                RocketPlugin.OnPluginLoading += (IRocketPlugin plugin, ref bool cancelLoading) =>
                {
                    try
                    {
                        plugin.TryAddComponent <PluginUnturnedPlayerComponentManager>();
                    }
                    catch (Exception ex)
                    {
                        Core.Logging.Logger.LogException(ex, "Failed to load plugin " + plugin.Name + ".");
                        cancelLoading = true;
                    }
                };

                RocketPlugin.OnPluginUnloading += (IRocketPlugin plugin) =>
                {
                    plugin.TryRemoveComponent <PluginUnturnedPlayerComponentManager>();
                };

                R.Commands.RegisterFromAssembly(Assembly.GetExecutingAssembly());

                try
                {
                    R.Plugins.OnPluginsLoaded += () =>
                    {
                        SteamGameServer.SetKeyValue("rocketplugins", String.Join(",", R.Plugins.GetPlugins().Select(p => p.Name).ToArray()));
                    };


                    SteamGameServer.SetKeyValue("rocket", Assembly.GetExecutingAssembly().GetName().Version.ToString());
                    SteamGameServer.SetBotPlayerCount(1);
                }
                catch (Exception ex)
                {
                    Core.Logging.Logger.LogError("Steam can not be initialized: " + ex.Message);
                }

                OnRocketImplementationInitialized.TryInvoke();
            }
            catch (Exception ex)
            {
                Core.Logging.Logger.LogException(ex);
            }
        }
예제 #16
0
 /// <inheritdoc />
 public override void CloseConnection(string goodbye = "")
 {
     Player.Disconnected.Fire(goodbye);
     Player.Destroy();
     SteamGameServer.EndAuthSession(SteamId);
     base.CloseConnection(goodbye);
 }
예제 #17
0
        void OnClientBeginAuthentication(CSteamID clientID, byte[] pToken, int uTokenLen)
        {
            // If the clientdata is already in use, refuse anymore connections
            if (ClientData.bActive)
            {
                // CallbackMsg_t msg;

                // Tell the client that authentication failed or server is full
                // BSendDataToClient(clientID, &msg, sizeof(msg));
                MsgServerFailAuthentication msg = new MsgServerFailAuthentication();
                byte[] msg_array = Converter.ObjectToByteArray(msg);
                uint   size      = (uint)(msg_array.Length * sizeof(byte)); // Another way to calculate size, dont know if it works

                SteamGameServerNetworking.SendP2PPacket(clientID, msg_array, (uint)Marshal.SizeOf(msg_array), EP2PSend.k_EP2PSendReliable);
                return;
            }
            else
            {
                // ClientData[i].TickCountSinceLastData = Current Game Tick Time

                // Authenticate User With Steam Back-End Servers
                if (SteamGameServer.BeginAuthSession(pToken, uTokenLen, clientID) != EBeginAuthSessionResult.k_EBeginAuthSessionResultOK)
                {
                    MsgServerFailAuthentication msg = new MsgServerFailAuthentication();
                    byte[] msg_array = Converter.ObjectToByteArray(msg);
                    uint   size      = (uint)(msg_array.Length * sizeof(byte)); // Another way to calculate size, dont know if it works

                    SteamGameServerNetworking.SendP2PPacket(clientID, msg_array, (uint)Marshal.SizeOf(msg_array), EP2PSend.k_EP2PSendReliable);
                }

                ClientData.SteamIDUser = clientID;
                ClientData.bActive     = true;
            }
        }
예제 #18
0
    private IEnumerator Start()
    {
        PlayerPrefs.Save();
        CoopTreeGrid.Init();
        LoadSave.OnGameStart += this.OnGameStart;
        yield return(CoopPeerStarter.PrefabDbResource);

        if (!CoopPeerStarter.Dedicated)
        {
            CoopLobby.Instance.SetServer(SteamGameServer.GetSteamID());
        }
        BoltConfig config = base.GetConfig();

        config.serverConnectionLimit = ((!CoopPeerStarter.Dedicated) ? (CoopLobby.Instance.Info.MemberLimit - 1) : SteamDSConfig.ServerPlayers);
        if (CoopPeerStarter.Dedicated)
        {
            BoltLauncher.SetUdpPlatform(new DotNetPlatform());
            BoltLauncher.StartServer(SteamDSConfig.EndPoint, config);
        }
        else
        {
            BoltLauncher.StartServer(SteamGameServer.GetSteamID().ToEndPoint(), config);
        }
        try
        {
            BoltNetwork.AddGlobalEventListener(CoopAckChecker.Instance);
        }
        catch
        {
        }
        yield break;
    }
예제 #19
0
 public void LogOn()
 {
     SteamGameServer.SetModDir("PlanetExplorers");
     SteamGameServer.SetProduct("PlanetExplorers");
     SteamGameServer.SetGameDescription("Planet Explorers");
     SteamGameServer.LogOnAnonymous();
 }
예제 #20
0
 public void LogOff()
 {
     if (initialized && SteamGameServer.BLoggedOn())
     {
         SteamGameServer.EnableHeartbeats(false);
         SteamGameServer.LogOff();
     }
 }
예제 #21
0
 private void SendUpdatedServerDetailsToSteam()
 {
     SteamGameServer.SetMaxPlayerCount(SteamDSConfig.ServerPlayers);
     SteamGameServer.SetPasswordProtected(false);
     SteamGameServer.SetServerName(SteamDSConfig.ServerName);
     SteamGameServer.SetBotPlayerCount(0);
     SteamGameServer.SetMapName(SteamDSConfig.MapName);
 }
예제 #22
0
 static void ClampMaxPlayers(int level)
 {
     if (Provider.maxPlayers > 24)
     {
         SteamGameServer.SetMaxPlayerCount(24);
         System.Console.WriteLine("MaxPlayers Clamped");
     }
 }
예제 #23
0
 private void SendUpdatedServerDetailsToSteam()
 {
     SteamGameServer.SetMaxPlayerCount(SteamDSConfig.ServerPlayers);
     SteamGameServer.SetPasswordProtected(!string.IsNullOrEmpty(SteamDSConfig.ServerPassword));
     SteamGameServer.SetServerName(SteamDSConfig.ServerName);
     SteamGameServer.SetMapName(SteamDSConfig.MapName);
     SteamGameServer.SetGameTags(SteamDSConfig.ServerGUID + ";__F486E3E06B8E13E0388571BE0FDC8A35182D8BE83E9256BA53BC5FBBDBCF23BC");
     SteamGameServer.ForceHeartbeat();
 }
예제 #24
0
        public static bool UpdateServerInfo()
        {
            if (SteamGameServer.BLoggedOn())
            {
                SteamManager.Instance.SetAdditionalGameInfo();
            }

            return(false);
        }
예제 #25
0
 private void SendUpdatedServerDetailsToSteam()
 {
     SteamGameServer.SetMaxPlayerCount(SteamDSConfig.ServerPlayers);
     SteamGameServer.SetPasswordProtected(!string.IsNullOrEmpty(SteamDSConfig.ServerPassword));
     SteamGameServer.SetServerName(SteamDSConfig.ServerName);
     SteamGameServer.SetMapName(SteamDSConfig.MapName);
     SteamGameServer.SetGameTags(SteamDSConfig.ServerGUID + ";__E3C26D06F07B6AB14EC25F4823E9A30D6B4ED0450527C1E768739D96C9F061AE");
     SteamGameServer.ForceHeartbeat();
 }
예제 #26
0
 private void OnSteamServersConnected(SteamServersConnected_t LogonSuccess)
 {
     _connectedToSteam = true;
     SteamGameServer.SetMaxPlayerCount(4);
     SteamGameServer.SetPasswordProtected(false);
     SteamGameServer.SetServerName("Snakes");
     SteamGameServer.SetBotPlayerCount(0);
     SteamGameServer.SetMapName("inGame");
 }
예제 #27
0
 void OnDisable()
 {
     if (gs_Initialized)
     {
         SteamGameServer.LogOff();
         GameServer.Shutdown();
         Debug.Log("Shutdown.");
     }
 }
예제 #28
0
        public override void UpdateScore(Identity ident, uint score)
        {
            if (ident.Owner == null)
            {
                return;
            }
            var steamIdent = (SteamIdentity)ident;

            SteamGameServer.BUpdateUserData(steamIdent.SteamID, steamIdent.Owner.Name, score);
        }
 // Token: 0x06001835 RID: 6197 RVA: 0x000890AC File Offset: 0x000874AC
 public void close()
 {
     if (!this.isHosting)
     {
         return;
     }
     SteamGameServer.EnableHeartbeats(false);
     SteamGameServer.LogOff();
     GameServer.Shutdown();
     this.isHosting = false;
 }
예제 #30
0
 private void OnPlayerConnect(UnturnedPlayer player)
 {
     if (Provider.maxPlayers == Provider.clients.Count && Provider.maxPlayers + 1 != Configuration.Instance.MaximumDynamicSlot)
     {
         Provider.maxPlayers++;
         if (Provider.maxPlayers > 24)
         {
             SteamGameServer.SetMaxPlayerCount(24);
         }
     }
 }