[Chat] Add missing server is not running warning (#567)
* [Dedicated] Is running function * [Dedicated]: Better func
This commit is contained in:
parent
20ce38f196
commit
56baaaf0f5
@ -227,7 +227,7 @@ namespace Components
|
||||
{
|
||||
Command::Add("banClient", [](Command::Params* params)
|
||||
{
|
||||
if (!(*Game::com_sv_running)->current.enabled)
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print("Server is not running.\n");
|
||||
return;
|
||||
@ -271,7 +271,7 @@ namespace Components
|
||||
|
||||
Command::Add("unbanClient", [](Command::Params* params)
|
||||
{
|
||||
if (!(*Game::com_sv_running)->current.enabled)
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print("Server is not running.\n");
|
||||
return;
|
||||
|
@ -296,9 +296,9 @@ namespace Components
|
||||
{
|
||||
Command::AddSV("muteClient", [](Command::Params* params)
|
||||
{
|
||||
if (!(*Game::com_sv_running)->current.enabled)
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print("Server is not running.\n");
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Server is not running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -319,9 +319,9 @@ namespace Components
|
||||
|
||||
Command::AddSV("unmute", [](Command::Params* params)
|
||||
{
|
||||
if (!(*Game::com_sv_running)->current.enabled)
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print("Server is not running.\n");
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Server is not running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -356,6 +356,12 @@ namespace Components
|
||||
|
||||
Command::AddSV("say", [](Command::Params* params)
|
||||
{
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Server is not running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params->size() < 2) return;
|
||||
|
||||
auto message = params->join(1);
|
||||
@ -375,6 +381,12 @@ namespace Components
|
||||
|
||||
Command::AddSV("tell", [](Command::Params* params)
|
||||
{
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Server is not running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params->size() < 3) return;
|
||||
|
||||
const auto client = std::atoi(params->get(1));
|
||||
@ -395,6 +407,12 @@ namespace Components
|
||||
|
||||
Command::AddSV("sayraw", [](Command::Params* params)
|
||||
{
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Server is not running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params->size() < 2) return;
|
||||
|
||||
auto message = params->join(1);
|
||||
@ -404,6 +422,12 @@ namespace Components
|
||||
|
||||
Command::AddSV("tellraw", [](Command::Params* params)
|
||||
{
|
||||
if (!Dedicated::IsRunning())
|
||||
{
|
||||
Logger::Print(Game::CON_CHANNEL_SERVER, "Server is not running.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (params->size() < 3) return;
|
||||
|
||||
const auto client = atoi(params->get(1));
|
||||
|
@ -19,6 +19,12 @@ namespace Components
|
||||
return flag.value();
|
||||
}
|
||||
|
||||
bool Dedicated::IsRunning()
|
||||
{
|
||||
assert(*Game::com_sv_running);
|
||||
return *Game::com_sv_running && (*Game::com_sv_running)->current.enabled;
|
||||
}
|
||||
|
||||
void Dedicated::InitDedicatedServer()
|
||||
{
|
||||
static const char* fastfiles[7] =
|
||||
@ -261,7 +267,7 @@ namespace Components
|
||||
|
||||
Scheduler::Loop([]
|
||||
{
|
||||
if ((*Game::com_sv_running)->current.enabled)
|
||||
if (Dedicated::IsRunning())
|
||||
{
|
||||
Dedicated::TransmitGuids();
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ namespace Components
|
||||
static Dvar::Var COMLogFilter;
|
||||
|
||||
static bool IsEnabled();
|
||||
static bool IsRunning();
|
||||
|
||||
static void Heartbeat();
|
||||
|
||||
|
@ -423,7 +423,7 @@ namespace Components
|
||||
playerInfo["ping"] = 0;
|
||||
playerInfo["name"] = "";
|
||||
|
||||
if ((*Game::com_sv_running)->current.enabled)
|
||||
if (Dedicated::IsRunning())
|
||||
{
|
||||
if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue;
|
||||
|
||||
|
@ -138,7 +138,7 @@ namespace Components
|
||||
|
||||
bool Party::IsInLobby()
|
||||
{
|
||||
return (!(*Game::com_sv_running)->current.enabled && PartyEnable.get<bool>() && Dvar::Var("party_host").get<bool>());
|
||||
return (!Dedicated::IsRunning() && PartyEnable.get<bool>() && Dvar::Var("party_host").get<bool>());
|
||||
}
|
||||
|
||||
bool Party::IsInUserMapLobby()
|
||||
@ -351,7 +351,7 @@ namespace Components
|
||||
info.set("isPrivate", (Dvar::Var("g_password").get<std::string>().size() ? "1" : "0"));
|
||||
info.set("hc", (Dvar::Var("g_hardcore").get<bool>() ? "1" : "0"));
|
||||
info.set("securityLevel", Utils::String::VA("%i", Dvar::Var("sv_securityLevel").get<int>()));
|
||||
info.set("sv_running", ((*Game::com_sv_running)->current.enabled ? "1" : "0"));
|
||||
info.set("sv_running", (Dedicated::IsRunning() ? "1" : "0"));
|
||||
info.set("aimAssist", (Gamepad::sv_allowAimAssist.get<bool>() ? "1" : "0"));
|
||||
info.set("voiceChat", (Voice::SV_VoiceEnabled() ? "1" : "0"));
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace Components
|
||||
{
|
||||
info.set("matchtype", "1");
|
||||
}
|
||||
else if ((*Game::com_sv_running)->current.enabled) // Match hosting
|
||||
else if (Dedicated::IsRunning()) // Match hosting
|
||||
{
|
||||
info.set("matchtype", "2");
|
||||
}
|
||||
@ -206,7 +206,7 @@ namespace Components
|
||||
auto ping = 0;
|
||||
std::string name;
|
||||
|
||||
if ((*Game::com_sv_running)->current.enabled)
|
||||
if (Dedicated::IsRunning())
|
||||
{
|
||||
if (Game::svs_clients[i].header.state < Game::CS_CONNECTED) continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user