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())); } }
private void ClampMaxPlayers() { if (Provider.maxPlayers > 24) { SteamGameServer.SetMaxPlayerCount(24); } }
//----------------------------------------------------------------------------- // 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" ); }
static void ClampMaxPlayers(int level) { if (Provider.maxPlayers > 24) { SteamGameServer.SetMaxPlayerCount(24); System.Console.WriteLine("MaxPlayers Clamped"); } }
private void SendUpdatedServerDetailsToSteam() { SteamGameServer.SetMaxPlayerCount(SteamDSConfig.ServerPlayers); SteamGameServer.SetPasswordProtected(false); SteamGameServer.SetServerName(SteamDSConfig.ServerName); SteamGameServer.SetBotPlayerCount(0); SteamGameServer.SetMapName(SteamDSConfig.MapName); }
private void OnSteamServersConnected(SteamServersConnected_t LogonSuccess) { _connectedToSteam = true; SteamGameServer.SetMaxPlayerCount(4); SteamGameServer.SetPasswordProtected(false); SteamGameServer.SetServerName("Snakes"); SteamGameServer.SetBotPlayerCount(0); SteamGameServer.SetMapName("inGame"); }
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(); }
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(); }
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); } } }
private void ClampMaxPlayers(int level) { if (Provider.maxPlayers > 24) { SteamGameServer.SetMaxPlayerCount(24); } if (Configuration.Instance.EnableMaxPlayerOnStart) { Provider.maxPlayers = Configuration.Instance.MaxPlayerOnStart; } }
private void ServerConnectedCallback(SteamServersConnected_t callback) { Debug.Log("[Steamworks.NET] GameServer connected successfully"); SteamGameServer.SetServerName(ServerConfig.ServerName); SteamGameServer.SetPasswordProtected(!string.IsNullOrEmpty(ServerConfig.Password)); SteamGameServer.SetMaxPlayerCount(ServerConfig.TeamNum * ServerConfig.NumPerTeam); SteamGameServer.SetMapName(ServerConfig.MapName); SteamGameServer.SetDedicatedServer(true); SetAdditionalGameInfo(); SteamGameServer.EnableHeartbeats(true); }
void SendUpdatedServerSteam() { SteamGameServer.SetMaxPlayerCount(4); SteamGameServer.SetPasswordProtected(false); SteamGameServer.SetServerName("Snakes"); SteamGameServer.SetBotPlayerCount(0); SteamGameServer.SetMapName("inGame"); #if USE_GS_AUTH_API for (uint i = 0; i < 4; ++i) { } #endif }
public static void SetModded() { try { using (TimeWarning.New("UpdateServerInformation", 0.1f)) { SteamGameServer.SetServerName(ConVar.Server.hostname); SteamGameServer.SetMaxPlayerCount(ConVar.Server.maxplayers); SteamGameServer.SetPasswordProtected(false); SteamGameServer.SetMapName(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name); string pchGameTags = string.Format("mp{0},cp{1},v{2}{3}{4}", new object[] { ConVar.Server.maxplayers, BasePlayer.activePlayerList.Count, Rust.Protocol.network, ConVar.Server.pve ? ",pve" : string.Empty, pluton.enabled ? ",modded,pluton" : string.Empty }); SteamGameServer.SetGameTags(pchGameTags); string[] array = ConVar.Server.description.SplitToChunks(100).ToArray <string>(); for (int i = 0; i < 16; i++) { if (i < array.Length) { SteamGameServer.SetKeyValue(string.Format("description_{0:00}", i), array[i]); } else { SteamGameServer.SetKeyValue(string.Format("description_{0:00}", i), String.Empty); } } SteamGameServer.SetKeyValue("country", SteamGameServerUtils.GetIPCountry()); SteamGameServer.SetKeyValue("world.seed", global::World.Seed.ToString()); SteamGameServer.SetKeyValue("world.size", global::World.Size.ToString()); SteamGameServer.SetKeyValue("official", ConVar.Server.official.ToString()); SteamGameServer.SetKeyValue("pve", ConVar.Server.pve.ToString()); SteamGameServer.SetKeyValue("headerimage", ConVar.Server.headerimage); SteamGameServer.SetKeyValue("url", ConVar.Server.url); SteamGameServer.SetKeyValue("uptime", ((int)Time.realtimeSinceStartup).ToString()); SteamGameServer.SetKeyValue("mem_ws", Performance.usedMemoryWorkingSetMB.ToString()); SteamGameServer.SetKeyValue("mem_pv", Performance.usedMemoryPrivateMB.ToString()); SteamGameServer.SetKeyValue("gc_mb", Performance.memoryAllocations.ToString()); SteamGameServer.SetKeyValue("gc_cl", Performance.memoryCollections.ToString()); SteamGameServer.SetKeyValue("fps", Performance.frameRate.ToString()); SteamGameServer.SetKeyValue("fps_avg", Performance.frameRateAverage.ToString("0.00")); SteamGameServer.SetKeyValue("ent_cnt", BaseNetworkable.serverEntities.Count.ToString()); SteamGameServer.SetKeyValue("build", BuildInformation.VersionStampDays.ToString()); } } catch (Exception ex) { Logger.LogError("[Hooks] Error while setting the server modded."); Logger.LogException(ex); } }
private void OnPlayerDisconnect(UnturnedPlayer player) { if (Provider.clients.Count >= baseMaxPlayers) { Provider.maxPlayers--; if (Provider.maxPlayers < baseMaxPlayers) { Provider.maxPlayers = baseMaxPlayers; } } if (Provider.maxPlayers > 24) { SteamGameServer.SetMaxPlayerCount(24); } }
object OnServerCommand(string command) { var args = command.Trim().ToLower().Split(' '); if (!args[0].Equals("maxplayers") || !int.TryParse(args[1], out maxPlayers)) { return(null); } maxPlayers = Math.Min(60, (maxPlayers == 0 ? 1 : maxPlayers)); GameManager.Instance.ServerConfig.MaxPlayers = maxPlayers; if (SteamworksManagerClient.Instance.InitializedServer) { SteamGameServer.SetMaxPlayerCount(maxPlayers); } return(true); }
public static bool RegisterServer_modded(string name, bool password, string version, bool publicServer, string worldName, ZSteamMatchmaking __instance) { __instance.UnregisterServer(); SteamGameServer.SetServerName(config.ServerName); SteamGameServer.SetMapName(config.SteamMapName); SteamGameServer.SetPasswordProtected(password); SteamGameServer.SetGameTags(version); SteamGameServer.EnableHeartbeats(publicServer); SteamGameServer.SetMaxPlayerCount(config.Size); SteamGameServer.SetGameDescription("Valheim"); AccessTools.Field(typeof(ZSteamMatchmaking), "m_registerServerName").SetValue(__instance, config.ServerName); AccessTools.Field(typeof(ZSteamMatchmaking), "m_registerPassword").SetValue(__instance, password); AccessTools.Field(typeof(ZSteamMatchmaking), "m_registerVerson").SetValue(__instance, version); print("Registering lobby (modded)"); return(false); }
void Init() => GameManager.Instance.ServerConfig.MaxPlayers = 244; // DO NOT EDIT THIS object OnRunCommand(string command) { var args = command.Trim().ToLower().Split(' '); int maxPlayers; if (!args[0].Equals("maxplayers") || !int.TryParse(args[1], out maxPlayers)) { return(null); } if (maxPlayers >= 60) { PrintWarning("Setting maxplayers above 60 may cause severe performance issues. Use with caution!"); } maxPlayers = Math.Min(244, (maxPlayers == 0 ? 1 : maxPlayers)); GameManager.Instance.ServerConfig.MaxPlayers = maxPlayers; if (SteamworksManagerClient.Instance.InitializedServer) { SteamGameServer.SetMaxPlayerCount(maxPlayers); } return(true); }
public void OnServerLoad() { if (Configuration.Instance.Enabled) { if (Configuration.Instance.ResetToDefault) { SteamGameServer.SetKeyValue("rocketplugins", string.Join(",", R.Plugins.GetPlugins().Select(p => p.Name).ToArray())); } else { if (Configuration.Instance.HideRocketPlugins) { SteamGameServer.SetKeyValue("rocketplugins", ""); Logger.Log("SS - Hidden Rocket Plugins! :^) "); } if (Configuration.Instance.ReplaceRocketPlugins) { SteamGameServer.SetKeyValue("rocketplugins", Configuration.Instance.CustomRocketPluginsText); Logger.Log("SS - Replaced Rocket Plugins Text! :^) "); } if (Configuration.Instance.HideWorkshopItems) { SteamGameServer.SetKeyValue("Browser_Workshop_Count", "0"); Logger.Log("SS - Hidden Workshop Items! :^) "); } if (Configuration.Instance.ReplaceWorkshopItems) { SteamGameServer.SetKeyValue("Browser_Workshop_Count", Configuration.Instance.WorkshopLinesCount.ToString()); SteamGameServer.SetKeyValue("Browser_Workshop_Line", Configuration.Instance.CustomWorkshopItemsText); Logger.Log("SS - Replaced Workshop Items Text! :^) "); } if (Configuration.Instance.HideConfigItems) { SteamGameServer.SetKeyValue("Browser_Config_Count", "0"); Logger.Log("SS - Hidden Config Items! :^) "); } if (Configuration.Instance.ReplaceConfigItems) { SteamGameServer.SetKeyValue("Browser_Config_Count", Configuration.Instance.ConfigLinesCount.ToString()); SteamGameServer.SetKeyValue("Browser_Config_Line", Configuration.Instance.CustomConfigItemsText); Logger.Log("SS - Replace Config Items Text! :^) "); } if (Configuration.Instance.EnableCustomMapName) { SteamGameServer.SetMapName(Configuration.Instance.MapCustomName); Logger.Log("SS - Set Map Name to (" + Configuration.Instance.MapCustomName + ") ! :^) "); } if (Configuration.Instance.EnableMaxPlayers) { SteamGameServer.SetMaxPlayerCount(Configuration.Instance.MaxServerPlayers); Logger.Log("SS - Set Max players count to (" + Configuration.Instance.MaxServerPlayers + ") ! :^) "); } if (Configuration.Instance.EnableCustomServerName) { SteamGameServer.SetServerName(Configuration.Instance.ServerName); Logger.Log("SS - Set Server Name to (" + Configuration.Instance.ServerName + ") ! :^) "); } Logger.Log("SS - Done!"); } } else { Logger.Log("SS - Please Enable me in the Configuration in order for me to work :D!"); Unload(); } }
public override void SetMaxPlayerCount(int maxPlayers) { SteamGameServer.SetMaxPlayerCount(maxPlayers); }