Hotfix - server loading

- Fix for server loading
This commit is contained in:
Dawid Bepierszcz 2024-11-22 23:01:31 +01:00
parent b2ebe136c3
commit 2defb2fe14
3 changed files with 15 additions and 6 deletions

View file

@ -15,7 +15,7 @@ public class ServerManager
{
if (CS2_SimpleAdmin.ServerLoaded || CS2_SimpleAdmin.ServerId != null || CS2_SimpleAdmin.Database == null) return;
if (_getIpTryCount > 16)
if (_getIpTryCount > 16 && Helper.GetServerIp().StartsWith("0.0.0.0") || string.IsNullOrEmpty(Helper.GetServerIp()))
{
CS2_SimpleAdmin._logger?.LogError("Unable to load server data - can't fetch ip address!");
return;
@ -39,6 +39,8 @@ public class ServerManager
var address = $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";
var hostname = ConVar.Find("hostname")!.StringValue;
CS2_SimpleAdmin.IpAddress = address;
CS2_SimpleAdmin._logger?.LogInformation("Loaded server with ip {ip}", ipAddress);
Task.Run(async () =>
{